-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lerna updates all packages with every publish #2487
Comments
Looking at your {
"version": "0.0.19",
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true
} I noticed there are no {
"command": {
"publish": {
"conventionalCommits": true,
"message": "[skip ci] chore: release"
}
},
"ignoreChanges": [
"**/CHANGELOG.md",
"**/node_modules/**",
"**/package.json",
"**/*.md",
"**/perf/**"
],
"lifecycle": {
"version": "npm run build && git add ."
},
"packages": [
"packages/*"
],
"version": "independent"
} Please try to add copious I'd rule out |
Great idea! I didn't know that this field existed. It doesn't seem to solve the problem however. In my example repo, I added a file to the However, when I try to publish, lerna still insists that I publish every package. I don't even have a build (or any source files) in this project that I think could possibly be mutating to create a confusing diff. |
Can it be that versioning is not set to be independent? The |
A teammate brought up that same point to me. But my understanding from the documentation is that even in fixed version mode, only the packages that have changed should be updated. From, the Fixed/Locked mode section of the README:
I don't want every package to be published every time (that's just a waste of space on the package server), but what I do want is all packages that are updated to get the same new version number, even if that version number skips because that package hasn't been updated in awhile. |
That's basically a mix of two systems... But that's not possible. Because in that case, if, in theory some "untouched" packages would be left on an old versions, the versioning would diverge — it would become "Independent" mode. The idea of "Fixed" is that all packages in monorepo have the same version, no matter what. |
So are you saying that the README section I quoted above is incorrect? |
I was wrong. You're right. It's something else then. A quick shot, can it be that in semver, in pre-v1, all versions count as breaking? Hypothesis being that if demo repo versions were at least v1 minor/patch bumps would not breaking and would not bump all? I can't find a reference quickly... |
Huh! That seems to work in my example repo. Interesting, I had never heard of such a convention, thank you for pointing it out! If you don't mind, I would like a little time to test this in an actual repository to see if I can get the same result. |
That totally worked! Wow that's a relief. Thank you again. Do you think it would be worth adding a note to that fixed/locked section of the README to warn people about that? |
Yeah, are you happy to raise an MR? |
Absolutely! |
Hey all, the way "version": "independent" works is I believe, it creates tag for every package and pushes it on github (if below flags are not used --no-git-tag-version --no-push) so in order for this to work and only bump up updated packages I need to remove flag -no-git-tag-version which creates a big problem by pushing lot of tags every time on github for all packages. What we want is bump up the version of only changed packages and create a release tag (for example r1) for that particular publish cycle. so using lerna version only for appropriate bumping of package versioning and changelog. How can this be done in the best way? |
Expected Behavior
Lerna should only update packages that have changed. From the README:
Current Behavior
Instead of only updating packages that have changed, lerna updates every package with every change.
Both
lerna updated
andlerna changed
return the correct result. Changing only a single package only displays changes from that package and packages that depend on that package.Steps to Reproduce (for bugs)
lerna updated
orlerna changed
. Notice that only two@test/checkbox
and the one package that depends on checkbox are shown to be updated (this is correct behavior).lerna publish
, choose "patch", and see that it lists every package in the repository as changed, when only two packages should have changed:lerna.json
Context
Your Environment
lerna --version
npm --version
yarn --version
node --version
The text was updated successfully, but these errors were encountered: