-
Notifications
You must be signed in to change notification settings - Fork 247
fix(pm): keep Yarn catalog: references intact through vp up
#2432
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...li_snapshots/tests/cli_snapshots/fixtures/command_update_catalog_protocol_yarn/.gitignore
This file contains hidden or 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 @@ | ||
| node_modules/ |
7 changes: 7 additions & 0 deletions
7
..._snapshots/tests/cli_snapshots/fixtures/command_update_catalog_protocol_yarn/package.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "name": "command-update-catalog-protocol-yarn", | ||
| "devDependencies": { | ||
| "vite": "^7.0.0" | ||
| }, | ||
| "packageManager": "yarn@4.12.0" | ||
| } |
37 changes: 37 additions & 0 deletions
37
...napshots/tests/cli_snapshots/fixtures/command_update_catalog_protocol_yarn/snapshots.toml
This file contains hidden or 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,37 @@ | ||
| [[case]] | ||
| name = "command_update_catalog_protocol_yarn" | ||
| vp = "global" | ||
| skip-platforms = ["windows"] | ||
| unset-env = ["CI", "VP_SKIP_INSTALL"] | ||
| local-registry = true | ||
| steps = [ | ||
| { argv = [ | ||
| "vp", | ||
| "migrate", | ||
| "--no-interactive", | ||
| "--no-hooks", | ||
| "--package-manager", | ||
| "yarn", | ||
| ], comment = "migrate pins the toolchain through the Yarn catalog", continue-on-failure = true }, | ||
| { argv = [ | ||
| "vpt", | ||
| "print-file", | ||
| "package.json", | ||
| ], comment = "the migrated project references the catalog", continue-on-failure = true }, | ||
| { argv = [ | ||
| "vp", | ||
| "up", | ||
| "vite", | ||
| "vite-plus", | ||
| ], comment = "#2309 Yarn variant: `yarn up` rewrites `catalog:` specs, so catalog-pinned names are skipped", continue-on-failure = true }, | ||
| { argv = [ | ||
| "vpt", | ||
| "print-file", | ||
| "package.json", | ||
| ], comment = "`vite` and `vite-plus` stay `catalog:` instead of concrete ranges", continue-on-failure = true }, | ||
| { argv = [ | ||
| "vpt", | ||
| "print-file", | ||
| ".yarnrc.yml", | ||
| ], comment = "the catalog keeps owning the resolved toolchain version", continue-on-failure = true }, | ||
| ] |
81 changes: 81 additions & 0 deletions
81
..._update_catalog_protocol_yarn/snapshots/command_update_catalog_protocol_yarn.md
This file contains hidden or 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,81 @@ | ||
| # command_update_catalog_protocol_yarn | ||
|
|
||
| ## `vp migrate --no-interactive --no-hooks --package-manager yarn` | ||
|
|
||
| migrate pins the toolchain through the Yarn catalog | ||
|
|
||
| ``` | ||
| VITE+ - The Unified Toolchain for the Web | ||
|
|
||
| ⚠ Vite+ does not currently support Yarn Plug'n'Play (PnP). | ||
|
|
||
| ✔ Switched Yarn to node-modules mode | ||
|
|
||
| Formatting code... | ||
|
|
||
| Code formatted | ||
| ◇ Migrated . to Vite+ <version> | ||
| • Node <version> yarn <version> | ||
| ✓ Dependencies installed in <duration> | ||
| • 1 config update applied | ||
| • Package manager settings configured | ||
| ``` | ||
|
|
||
| ## `vpt print-file package.json` | ||
|
|
||
| the migrated project references the catalog | ||
|
|
||
| ``` | ||
| { | ||
| "name": "command-update-catalog-protocol-yarn", | ||
| "devDependencies": { | ||
| "vite": "catalog:", | ||
| "vite-plus": "catalog:" | ||
| }, | ||
| "resolutions": { | ||
| "vite": "npm:@voidzero-dev/vite-plus-core@<version>" | ||
| }, | ||
| "packageManager": "yarn@4.12.0" | ||
| } | ||
| ``` | ||
|
|
||
| ## `vp up vite vite-plus` | ||
|
|
||
| #2309 Yarn variant: `yarn up` rewrites `catalog:` specs, so catalog-pinned names are skipped | ||
|
|
||
| ``` | ||
| warn: Skipped vite: the Yarn catalog pins its version, and `yarn up` would overwrite the `catalog:` reference. Edit the catalog entry in .yarnrc.yml, or run `vp migrate` when Vite+ manages the pin. | ||
| warn: Skipped vite-plus: the Yarn catalog pins its version, and `yarn up` would overwrite the `catalog:` reference. Edit the catalog entry in .yarnrc.yml, or run `vp migrate` when Vite+ manages the pin. | ||
| ``` | ||
|
|
||
| ## `vpt print-file package.json` | ||
|
|
||
| `vite` and `vite-plus` stay `catalog:` instead of concrete ranges | ||
|
|
||
| ``` | ||
| { | ||
| "name": "command-update-catalog-protocol-yarn", | ||
| "devDependencies": { | ||
| "vite": "catalog:", | ||
| "vite-plus": "catalog:" | ||
| }, | ||
| "resolutions": { | ||
| "vite": "npm:@voidzero-dev/vite-plus-core@<version>" | ||
| }, | ||
| "packageManager": "yarn@4.12.0" | ||
| } | ||
| ``` | ||
|
|
||
| ## `vpt print-file .yarnrc.yml` | ||
|
|
||
| the catalog keeps owning the resolved toolchain version | ||
|
|
||
| ``` | ||
| nodeLinker: node-modules | ||
| npmPreapprovedPackages: | ||
| - vitest | ||
| - "@vitest/*" | ||
| catalog: | ||
| vite: npm:@voidzero-dev/vite-plus-core@<version> | ||
| vite-plus: <version> | ||
| ``` |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a Yarn Berry user runs
vp up --recursive vitefor a catalog-pinned package, this filter removesviteand the following branch returnsNoop, so the requested lockfile refresh never occurs. Checked Yarn 4.14.1'syarn up --help:-R,--recursiveforces matching resolutions to be resolved again but does not touch manifests, so it cannot overwrite thecatalog:reference and should bypass this guard.Useful? React with 👍 / 👎.