support --token=npmToken in lerna Publish
See original GitHub issueExpected Behavior
since npm publish cannot use NPM_TOKEN as environment, user must write token into .npmrc in order to do lerna publish in CI|CD environment, which is kind of annoying, I think pass token as parameter is more convenient just like what beachball is doing https://microsoft.github.io/beachball/ci-integration
Current Behavior
Possible Solution
Steps to Reproduce (for bugs)
lerna.json
<!-- Please paste your `lerna.json` here -->
lerna-debug.log
<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->
Context
Your Environment
Executable | Version |
---|---|
lerna --version |
VERSION |
npm --version |
VERSION |
yarn --version |
VERSION |
node --version |
VERSION |
OS | Version |
---|---|
NAME | VERSION |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Version and Publish - Lerna
Lerna can increment your package's versions as well as publish your packages to NPM, and it provides a variety of options to make...
Read more >How To Manage Monorepos With Lerna - DigitalOcean
Lerna can help you manage packages and dependencies across projects within the monorepo. To add a package to your project, use the lerna...
Read more >@lerna/publish - npm
Start using @lerna/publish in your project by running `npm i ... by lerna version , lerna publish also supports the from-git keyword.
Read more >JavaScript Monorepos with Lerna - Semaphore CI
Lerna supports two modes: fixed and independent. ... On publication, you'll be prompted on what to do with each updated package.
Read more >lerna publish push to npm, but not updating dependencies
My Monorepo is currently managed by Lerna.js. It all works fine except for the GitHub actions workflow I use to automate the npm...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If I put
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
into a root-level.npmrc
and try to commit without a valid NPM_TOKEN in my path, I get an error saying:error An unexpected error occurred: "Failed to replace env in config: ${NPM_TOKEN}".
I understand why this happens, but this would be preventative for somebody working in this repo in an open source capacity - they wouldn’t be able to contribute.
edit: looks like I can do this in a GH action:
lerna publish
supports the exact same pattern asnpm publish
with respect to environment variables in npmrc files. OnceNPM_TOKEN
is configured in the CI variables, add this to your project root.npmrc
file:Note that the only
.npmrc
file respected by Lerna is the project root. Per-package (leaf node) npmrc files are ignored entirely. There’s also nothing special about theNPM_TOKEN
variable name, it’s just a convention.