In npm, I want to be able to install a package from a private GitHub repo as a dependency through the git+https
way without having to hardcode the actual github_username:personal_access_token
, but rather plug them into the dependency string as (environment) variables.
So instead of
package.json
:
...
"dependencies": {
...
"my-private-github-repo": "git+https://<github_username>:<personal_access_token>@github.com/some/package.git",
...
}
I would like something like this:
package.json
:
...
"dependencies": {
...
"my-private-github-repo": "git+https://${github_username}:${personal_access_token}@github.com/some/package.git",
...
}
Hardcoding credentials is a major no-no when applying version control to package.json
which I'd like to be able to do.
What is the best way to do this?