danieldietrich / npm-private

🚀A script that allows to use GitHub release assets as private npm dependencies.
0 stars 0 forks source link

Change the destination of downloaded tarballs #4

Open danieldietrich opened 5 years ago

danieldietrich commented 5 years ago

Currently we have a two-steps dependency installation process:

  1. Download assets / tarballs from a private repository using the preinstall hook (currently only GitHub is supported)
  2. Install tarball using a file:...tgz dependency

We download the tarballs to a local directory <project-root>/.npm-private, which has several caveats:

[trn] and [dup] could be solved by downloading & referencing tarball dependencies using a central location ~/.npm-private instead of <project-root>/.npm-private.

[ver] could be solved by breaking up multi repos to separate npm packages and using the standard npm git support:

We use the local user's .gitconfig in order to tell git to use https:// with credentials instead of ssh:// (the pass may be a GitHub access token).

git config --global url."https://user:pass@github.com".insteadOf ssh://git@github.com

That way we can use ssh:// urls in our package.json without exposing user credentials (see Git URLs as Dependencies):

{
    "dependencies": {
        "my-project": "git+ssh://git@github.com:my-org/my-project#semver:^5.0"
    }
}

Another solution: We skip the .gitconfig part and use GitHub with SSH instead.

danieldietrich commented 5 years ago

I've experimented a bit... In order to use git tags as dependencies

I think I will teak our existing npm-private script a bit instead (on monday)...