-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 will always publish all packages even if some are not changed #1357
Comments
I need more context: With fixed versioning (the default), it is intentional when doing a "normal" release to bump all current prereleased packages to the new "normal" release. The assumption is that you are "graduating" the prerelease out of alpha/beta/whatever, and no "normal"-versioned package (in a lerna context) should ever depend on prereleased local dependencies. |
This applies when using independent versioning too, correct? Not OP, but I similarly found that |
lerna.json: {
"lerna": "3.0.0-beta.14",
"version": "independent",
"commands": {
"publish": {
"ignoreChanges": [
"**/*.md",
"**/example/**",
"**/test/**"
]
}
},
"npmClient": "yarn",
"useWorkspaces": true
} Previously versioned as 10.0.0-beta.x |
same issue here. weird. I'm using maybe // lerna.json
{
"lerna": "2.9.0",
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": "true",
"version": "independent"
} |
seems like a workspaces issue? |
|
That’s `lerna diff`, but it does not show dependent bumps.
… On Apr 11, 2018, at 01:00, li.li ***@***.***> wrote:
lerna updated should tell me what exactly updated in code level. what I changed ?
lerna updated --detail ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Follow-up from my previous comment, when I run $ lerna diff
lerna info version 2.9.0
lerna info versioning independent {
"lerna": "2.9.0",
"npmClient": "yarn",
"useWorkspaces": true,
"version": "independent"
} edit: did some more digging and I found that if I ran |
Same problem here on react-admin, some packages contain no changes after v2.0.2 (e.g. Should lerna force a republish if a non-production dependency changed? |
I'm having the same issue. |
Nope, lerna diff doesn’t show dependent bumps.
… On Jun 14, 2018, at 14:16, Kevin Barabash ***@***.***> wrote:
I'm having the same issue. lerna diff appears to be accurate. Could use it to determine which packages need updating?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Should lerna force a republish if a non-production dependency changed?
Oh, I didn’t think that would happen. It sounds wrong, I agree. A test case repro would go a long way toward fixing it.
|
If I have some packages that are all using |
Check out #707 for why that will never happen. Sorry.
… On Jun 14, 2018, at 18:10, Kevin Barabash ***@***.***> wrote:
If I have some packages that are all using ^1.0.0 of some dependency and then that dependency gets bumped to 1.1.0 I would expect the packages that depend on it not require publishing unless one of those packages actually uses the new feature added in 1.1.0 in which case I would need to change that package to use that new feature. I'd also update its deps to be ^1.1.0 since it now requires that new feature.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I tracked down the code responsible for that in utils/collect-updates (I think), but there is no test around that I could use as an example for building a new test case. |
Most of that code is tested in the commands/publish tests, as there tends to be a lot of setup necessary and the validation is easier there.
… On Jun 14, 2018, at 23:48, Francois Zaninotto ***@***.***> wrote:
A test case repro would go a long way toward fixing it.
I tracked down the code responsible for that in utils/collect-updates (I think), but there is no test around that I could use as an example for building a new test case.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I tried to understand how your tests are organized and where the dependency resolution is tested in commands/publish tests, but I didn't manage to, sorry. It would be much easier if you had unit tests in the utils/ directory to take inspiration from. |
It's in the publish tests because it was only originally extracted to share with the "changed" subcommand (which used to be called "updated"), which uses the exact same logic to list what has changed since the last release. Doing tests under collect-updates would duplicate 80% of the existing tests under commands/publish. I started poking at it, and I've noticed some gaps in coverage from recent changes I made. I'm trying to figure out if it was intentional to have changes in |
At a more fundamental level when I run
with version 2.5.1 I get all the packages listed But when I do it with 2.4.0 I get no packages listed (what I expected) Surely there's a test to make sure updated returns no packages when --since is set to HEAD ? |
Pretty sure --since wasn’t implemented in 2.4.0? Anyway, why pass the flag anyway when it’s identical to the current HEAD?
… On Jul 11, 2018, at 07:57, Jonathan R Wickens ***@***.***> wrote:
At a more fundamental level when I run
lerna updated --since=current-branch
with version 2.5.1 I get all the packages listed
But when I do it with 2.4.0 I get no packages listed (what I expected)
Surely there's a test to make sure updated returns no packages when --since is set to HEAD ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@evocateur looks like this is the problem code for me: lerna/utils/collect-updates/collect-updates.js Lines 53 to 56 in 5863564
If I remove the What is the purpose of Related: |
@t-kelly Thanks for the detailed analysis! I want to say that There is almost definitely a bug there in independent mode. I don’t remember if the “graduation” scenario is completely handled in |
Any news about this bug? |
For those who might be in that situation, I didn't realize that if you update one of your package that is a dependency of your other packages it updates all of those as well. Seems pretty obvious now that I think about it, but because the version bump happens automatically in the |
There is a significant refactoring of versioning and publishing about to land, so I haven't had time to look into this directly. I still don't have a clear reproduction. |
@evocateur -- you should be able to reproduce it by:
|
@t-kelly If you're using the default versioning scheme, that's expected behavior if you're doing a non-prerelease. |
Even if I'm going from I agree it should update all packages from |
I personally did a lot of context-sensitive (i.e., "partial") beta prereleases in lerna/lerna itself (using "fixed" versioning) and never encountered this issue, so I'd really like a complete picture (config, commands, repo state) to get to the bottom of it. |
@evocateur I came up with a repro for this since I've been experiencing this issue for many months. I pushed to a repo here, but I've listed all of the steps below for creating the problem from scratch. My platform:
Repro steps:
Expected: only package1 changed |
Not sure if this will be helpful for debugging or just cloud the issue further, but our team at work uses lerna and encounters this issue on some of our systems. We have found that two computers can have many things in common but have different results when running
One asks to update 30+ repos the other needs to patch only 4. The issue persists after blowing up |
@brmscheiner sounds like that needs an issue of its own. Not sure its related to this thread. Recommend you create a new issue with this so its easier to track by the maintainers! 😄 |
From the top of my head I remember that lerna v1.0 behaved correctly. |
What is the state of this issue? Is this still under investigation? I'm a bit confused as everything worked pretty fine before v3 🤔 |
please fix it |
Been wondering if I was the only one experiencing this. I have a simple project running in
When I update |
@evolutionxbox I have the same problem |
@yvele do you merge using |
If you have this problem and you manually put tags instead of lerna:
The workarounds are:
The PR above makes lerna find unannotated tags with |
@evolutionxbox Nope but it may have happened a couple of times in my git history. Why? |
I believe the line should be changed from: const needsBump = (commandOptions.bump || "").startsWith("pre") to: const needsBump = (!commandOptions.bump || commandOptions.bump.startsWith("pre")) That way if someone performs a fixed |
@randy-askin How does that change differ from the actual current value? const needsBump = (commandOptions.bump || "").startsWith("pre") |
In the case of independent non-bump versioning, e.g. use of the interactive prompt to pick exactly what versions you want, |
Oh, jeez, you're totally right. Thanks for explaining it clearly to my toddler-addled brain. :) |
So I made the change and none of my unit tests failed, 😭 diff --git a/utils/collect-updates/collect-updates.js b/utils/collect-updates/collect-updates.js
index dfedf36..2dcce43 100644
--- a/utils/collect-updates/collect-updates.js
+++ b/utils/collect-updates/collect-updates.js
@@ -56,10 +56,11 @@ function collectUpdates(filteredPackages, packageGraph, execOpts, commandOptions
candidates = new Set();
const hasDiff = makeDiffPredicate(committish, execOpts, commandOptions.ignoreChanges);
- const needsBump = (commandOptions.bump || "").startsWith("pre")
- ? () => false
- : /* skip packages that have not been previously prereleased */
- node => node.prereleaseId;
+ const needsBump =
+ !commandOptions.bump || commandOptions.bump.startsWith("pre")
+ ? () => false
+ : /* skip packages that have not been previously prereleased */
+ node => node.prereleaseId;
packages.forEach((node, name) => {
if (forced.has(name) || needsBump(node) || hasDiff(node)) { *straps on big-kid test-writing boots* |
v3.10.1 hopefully fixes this |
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes lerna#1357 Huge thanks to all the contributors on that issue, especially @Adam13531 for their exceptionally detailed reproduction and @randy-askin for their clear (and patient!) identification of the ternary bug.
Expected Behavior
Only publish updated packages.
Current Behavior
All packages will be published, run
lerna updated
it lists all packages even if none of them are updated.Possible Solution
Took a quick look at the code, not entirely sure how it works but seems it's related to:
lerna/utils/collect-updates/collect-updates.js
Lines 46 to 55 in 4c4acee
Does this mean the package will always be published if the current version is a prelease like
x.x.x-beta.x
and nocdVersion
is present?It works properly when running with
lerna updated --cd-version prerelease
, is this intended?Steps to Reproduce (for bugs)
x.x.x-beta.x
yarn lerna updated
Your Environment
lerna --version
npm --version
yarn --version
node --version
The text was updated successfully, but these errors were encountered: