fix: fail when yarn.lock is updated in workspaces when --frozen-lockfile is used#6554
fix: fail when yarn.lock is updated in workspaces when --frozen-lockfile is used#6554robin-drexler wants to merge 1 commit intoyarnpkg:masterfrom
Conversation
|
Hey, is there anything that I can do to push things forward? :) |
|
ping folks 👋 🙏 The current behaviour of the |
|
Same question here: what can we do to help get this in? |
|
Some workarounds for CI can be found in #5840 |
|
Hey, sorry for now pinging back sooner. The change appears sound, but we're currently working on the v2 (scheduled before the end of the year) and I'm somewhat worried about introducing subtle bugs right before releasing the next major (the way I see it, the current v1 is, despite its shortcomings, relatively stable). One question in particular I'd need to see answered is why isn't |
|
I think I remember why it got implemented in the first place. It’s because running certain commands inside a child workspace needed to consider dependencies across the entire workspace ( I haven’t fully considered this current change but a safer approach might be to only enable I should also note that we long ago switched to using |
It looks like the yarn.lock file had gotten out of sync with dependencies, so I updated it. It looks like the `--frozen-lockfile` option, which is specifically designed to prevent this [does not actually work with workspaces][1] and so this may happen from time to time. If we can figure out a cross-platform workaround, then maybe we can apply that at some point. Otherwise, this will remain a bug until we take a shot at yarn v2 [1]: yarnpkg/yarn#6554
This should ensure that we don't run into the kind of issue mentioned
here:
#233 (comment)
Note that `--frozen-lockfile` is supposed to take care of this for us,
but it is a known issue that it doesn't work properly in monorepos:
yarnpkg/yarn#5840
There is a fix for it:
yarnpkg/yarn#6554
But the issue is nearly two years old and the PR is almost as old. Maintainer replies here:
yarnpkg/yarn#6554 (comment)
that:
> The change appears sound, but we're currently working on the v2
> (scheduled before the end of the year) and I'm somewhat worried about
> introducing subtle bugs right before releasing the next major (the
> way I see it, the current v1 is, despite its shortcomings, relatively
> stable)."
We face a similar concern in liferay-portal and have a ticket for that:
https://issues.liferay.com/browse/LPS-110313
This should ensure that we don't run into the kind of issue mentioned
here:
#233 (comment)
Note that `--frozen-lockfile` is supposed to take care of this for us,
but it is a known issue that it doesn't work properly in monorepos:
yarnpkg/yarn#5840
There is a fix for it:
yarnpkg/yarn#6554
But the issue is nearly two years old and the PR is almost as old. Maintainer replies here:
yarnpkg/yarn#6554 (comment)
that:
> The change appears sound, but we're currently working on the v2
> (scheduled before the end of the year) and I'm somewhat worried about
> introducing subtle bugs right before releasing the next major (the
> way I see it, the current v1 is, despite its shortcomings, relatively
> stable)."
We face a similar concern in liferay-portal and have a ticket for that:
https://issues.liferay.com/browse/LPS-110313
|
👋 I know, it's been a while, but is there any chance that this PR could be merged since it got an approval? :) Thanks a lot! |
I don't think the approval was from a core maintainer 😕 |
Summary
This PR is an attempt to fix that
yarndoes not fail when yarn.lock is updated in a workspace project although--frozen-lockfileis usedThe current PR version is meant as a starting point as I might have missed something.
The issue seems to be caused because the
patternspassed to theintegrityCheckeronly include the root's dependencies. So it never checks if dependencies of workspaces are missing in the lockfile.I wonder if always setting
includeWorkspaceDepstotruein the installation cli command is the right thing to do, especially since those patterns are referred to astopLevelPatternsat a later point, which might indicate that the workspaces dependencies are missing on purpose.Another idea I had (and that I tried before I found the flag), was to pass all patterns to the
integrityChecker, but otherwise leave them as is.Basically to add:
before: https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/install.js#L457 and use
allPatternsin place ofpatternsas argument.If anybody could point me in the right direction, I'd be happy to continue working on a fix.
Thanks a lot in advance! :)