lerna publish --force-publish --canary triggering publish lifecycle on root package.json
See original GitHub issueHello. I have a 40-package monorepo. In the root package.json
, I have a lerna publish --conventional-commits --force-publish
that we run when we want to do a release.
In addition, we have a CI job that does lerna publish --force-publish --canary
on every commit. This job fails because lerna is triggering the root package.json
publish
script.
Lerna states that it is going to publish 40 packages but, in addition, it runs publish also for the root package.
Is this intended?
Expected Behavior
Publish 40 packages.
Current Behavior
Publishes 40 packages and fails to publish the root package.
Possible Solution
Option to ignore root package.
lerna.json
{
"packages": [
"packages/lib/*",
"packages/services/*"
],
"version": "1.7.4"
}
Your Environment
Executable | Version |
---|---|
lerna --version |
3.13.1 |
npm --version |
6.4.1 |
node --version |
v10.15.3 |
OS | Version |
---|---|
Node Alpine Docker Image | node:10-alpine |
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
@lerna/publish | Yarn - Package Manager
When you run the new command lerna repair , lerna will execute a series of code migrations/codemods which update your workspace to the...
Read more >@auto-it/npm NPM | npm.io
By default auto will force publish all packages for monorepos. ... life cycle script will be enacted in the context of your root...
Read more >Managing Your Typescript Monorepo With Lerna and Codefresh
Once you publish your Monorepo, Lerna will update the releases that changed ... This will install your dependency in the root package.json.
Read more >Source - GitHub
[5.6.2](https://github.com/lerna/lerna/compare/v5.6.1...v5.6.2) ... Features - **publish:** include all dependencies in package graph by default, ...
Read more >Lerna prepublish
Skip any lifecycle scripts normally run (prepare, etc) in bootstrapped packages. ... Like Lerna Rush supports bulk versioning and package publishing, ...
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
In most cases you are not supposed to publish the root package, and should mark the
<root>/package.json
with"private": true
.During
lerna publish
, lerna will run lifecycle scriptspublish
andpostpublish
in the root package accordingly. This is intended. I think if you want to add a custom script inpackage.json
, you should avoid using the npm lifecycle scripts unless intended.Got it. Thanks for the clarification.