-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(yarn4): avoid overwriting non-npm protocols (#6723)
### Description Fixes #6715 Yarn 4 now makes the default protocol of `npm` (e.g. `"foo": "*"` is really `"foo": "npm:*"`) explicit in the lockfile representation. This means that workspaces that reference a package with and without a protocol will end up with multiple protocols for a single descriptor. e.g. If one package has a dependency `"c": "*"` and another package in the workspace has a dependency `"c": "workspace:*"` In Yarn3 those result in the following descriptors: `c@*, c@workspace:*, c@workspace:pkgs/c` In Yarn4 those result in the following descriptors: `c@npm:*, c@workspace:*, c@workspace:pkgs/c` We cannot get rid of the logic for case without a protocol as that would break our Yarn3 usage. ### Testing Instructions Added unit test that has a lockfile with mixed protocols. Existing unit tests verify the Yarn3 behavior is still supported. Closes TURBO-1856 Co-authored-by: Chris Olszewski <Chris Olszewski>
- Loading branch information
1 parent
473c581
commit b2832ab
Showing
3 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
crates/turborepo-lockfiles/fixtures/yarn4-mixed-protocol.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This file is generated by running "yarn install" inside your project. | ||
# Manual changes might be lost - proceed with caution! | ||
|
||
__metadata: | ||
version: 8 | ||
cacheKey: 10c0 | ||
|
||
"a@workspace:pkgs/a": | ||
version: 0.0.0-use.local | ||
resolution: "a@workspace:pkgs/a" | ||
dependencies: | ||
c: "npm:*" | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"b@workspace:pkgs/b": | ||
version: 0.0.0-use.local | ||
resolution: "b@workspace:pkgs/b" | ||
dependencies: | ||
c: "workspace:*" | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"c@npm:*, c@workspace:*, c@workspace:pkgs/c": | ||
version: 0.0.0-use.local | ||
resolution: "c@workspace:pkgs/c" | ||
languageName: unknown | ||
linkType: soft | ||
|
||
"yarn4-test@workspace:.": | ||
version: 0.0.0-use.local | ||
resolution: "yarn4-test@workspace:." | ||
languageName: unknown | ||
linkType: soft |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters