Better npm login workflow for CI
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
The CI systems depend on setting up properly ~/.npmrc file to allow npm publish to work.
At the moment there are several hack-pproaches to do this, e.g. https://github.com/postmanlabs/npm-cli-login or https://github.com/npm/cli/issues/3573#issuecomment-1095289243
It would be great to have npm support this out-of-the-box via npm login --ci flag to properly create the .npmrc file based on e.g. environment variables.
For private registries, the hack I need to use today is:
echo -n $NPM_REGISTRY_URL:_auth= | sed -E 's/([a-z]+:)//' > .npmrc
echo -n "$NPM_REGISTRY_USER:$NPM_REGISTRY_PASS" | openssl base64 -A >> .npmrc
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing npm login and npm publish command entry points, then review how ~/.npmrc is currently created for private registries. Define the --ci workflow and its environment-variable inputs, including registry credentials. Done means CI can create a usable .npmrc and publish without the shell and openssl workaround described here.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- ci-cd, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100