-
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
3.14.x: Prerelease publish failed to bump version
in most package.json
files.
#2107
Comments
Do you have any lifecycle scripts in the root or leaves that In any case, I would very much appreciate a minimal reproduction to make progress on a diagnosis. |
…pin. > Note: This is an empty commit because I mis-referenced the Lerna PR in the last commit (b42d92d). I meant, lerna/lerna#2107 but had written lerna/lerna#2100. In the same spirit as 840e2a7, this reverts commit adde690 which Renovate re-upgraded in #2810. Therefore, this commit also puts a restriction within Renovate's configuration to prevent further upgrades. Unfortunately, this means we're stuck at this version of Lerna until we get time to make a reproduction for the issue I logged when this first cropped up in lerna/lerna#2107, but I haven't yet found the cycles to make that happen. I guess our repository is a reliable reproduction, right now! cc @trevor-scheer @JakeDawkins @evans
We have this same issue in Babel, but with a "normal" version (non a prerelease). Version 7.5.0 had this problem; I had to manually update all the One thing that I noticed is that the I'm really sorry, but I'm going to give exactly the opposite of a minimal example. 😅 I'll also try to debug it and report anything I find. Steps to reproduce:
We don't have any EDIT: This is the
Maybe it is a bug in how cycles are handled? Note that we only have cycles in dev dependencies. |
I think the issue lies in this function https://github.com/lerna/lerna/blob/master/utils/query-graph/query-graph.js#L62 which was introduced in 3.14.0 If I understand it correctly it gets all the leaf packages first ( So the case we (babel) are running into is that after all the leaf packages are done, we have at least one package that is not a leaf ( //cc @bweggersen |
Great debugging! I was able to repro the bug through a new test case. I'll look into it and create a PR with a fix. Thanks everyone! |
@bweggersen I was also working on a PR 😛 |
Oh, I should have checked first! 🙃 I'm happy to let you drive the PR, if you want to, since you have pretty ASCII art :) Looking into the problem, this is what I came up with: master...bweggersen:bweggersen/cycle-with-common-parent For transparency and clarity, this is my understanding of the order of execution (based on existing lerna functionality): @evocateur Any feedback on what you think is the right thing to do here? |
I am following an approach similar to this:
I'm currently trying to make it work with nested cycles and cycles with intersection. |
Honestly, all the graph traversal stuff is extremely out of my wheelhouse. I'm very appreciative of the expert help here. @bweggersen I'm reviewing @nicolo-ribaudo's PR right now, I can take a look at your branch after my head stops spinning... |
Don't worry, I had to re-write the logic three times because initially I had no idea about what I was doing 😅 Fortunately things became clearer while I was working on it. Our approaches are completely different: I think that with my approach lerna respects the topological order better, but @bweggersen is way simpler. @bweggersen If you could give an opinion about my PR it would be really appreciated! |
@nicolo-ribaudo I really like your PR's improvements to the cyclic logging itself. Way more readable/actionable! |
Fix is in v3.16.0, just released |
Immense gratitude to those (especially @nicolo-ribaudo with the PR) who were able to jump in and get this resolved! ❤️ |
Thanks to a gracious fix to Lerna by the Babel community, this issue (originally reported in my lerna/lerna#2107) is no longer an issue in new versions of Lerna, thanks to the fix provided in lerna/lerna#2185. Ref: lerna/lerna#2185 Ref: lerna/lerna#2107
> In the same spirit as `apollo-server`: > apollographql/apollo-server@585085d4d8dd7ab Thanks to a gracious fix to Lerna by the Babel community, this issue (originally reported in my lerna/lerna#2107) is no longer an issue in new versions of Lerna, thanks to the fix provided in lerna/lerna#2185. Ref: lerna/lerna#2185 Ref: lerna/lerna#2107 cc @JakeDawkins cc @trevor-scheer
* Stop pinning Lerna to pre v3.14.0. > In the same spirit as `apollo-server`: > apollographql/apollo-server@585085d4d8dd7ab Thanks to a gracious fix to Lerna by the Babel community, this issue (originally reported in my lerna/lerna#2107) is no longer an issue in new versions of Lerna, thanks to the fix provided in lerna/lerna#2185. Ref: lerna/lerna#2185 Ref: lerna/lerna#2107 cc @JakeDawkins cc @trevor-scheer * chore(deps): update dependency lerna to v3.16.4
This behavior is a scripted behavior which we've used for some time now, but seems to have broken with 3.14.1 (presumably
3.14.0
too, but we'd been using3.13.4
before). Essentially, Lerna didn't bump theversion
s for the packages it said it was going to bump, committed the one that it did update (the very first one), and then went on to try and publish — ultimately failing because it attempts to publish over the previously published version.Expected Behavior
When running the following, I expect it to suggest bumping all the appropriate packages by a prerelease faction, prompt with proposed versions, and when confirmed, publish them to their appropriate
prerelease
versions (e.g..alpha.n
, in this case):As I expected, this yielded a prompt of suggested version bumps, as it typically does:
Two of these packages have relevancy to this bug, but I've included the full output for accuracy. Of note are:
and
Those will be relevant in the next section.
Current Behavior
The above typically works, publishing the proposed packages accordingly (barring registry failures), but it appears that some characteristics that I believe are new to
3.14.x
prevented it from updating all of the packages and it instead only committed (to Git) thepackage.json
bump to theversion
property for the very first package (in this case,apollo-datasource-rest
), and then proceeded to attempt to publish the other packages without bumping theversion
in theirpackage.json
's, resulting in:What's happened here is that it's tried publishing
[email protected]
(.3
), even though it said it was going to bump to and publish[email protected]
(.4
).Digging into the aftermath, I had the following commit on the tip of my branch (commit body expand-o'd in this
<detail>
for brevity):The `Publish` commit
Most of the version bumps are missing here, and it would have been expected to bump the other packages it thought it wanted to bump as well.
It had, however, gone ahead and
git tag
ged all the packages though (snipped some tags for brevity, again):And ultimately, it had published nothing. (I consider this a good thing, given its likely doomed fate!)
Steps to Reproduce (for bugs)
lerna.json
Context
I realize that undoing a failure here is difficult and there might be a better way to undo the failure, but in this case, I wasn't sure as to the best approach. Typically, if it does the bumps and fails in an
npm
step, I'm still able to usefrom-git
to use the committed details.In this case, however, the commit was suggesting that a bunch of packages had been updated in its message but the versions were only bumped for one. I therefore deleted the new
git tag
s both locally and on the remote server, my working tree to the previous (pre-Publish
) commit viagit reset --hard HEAD~
and tried the publish again.Ultimately, I reverted to
[email protected]
, tried again, and had success.Your Environment
lerna --version
npm --version
node --version
Happy to try and help however!
The text was updated successfully, but these errors were encountered: