-
Notifications
You must be signed in to change notification settings - Fork 245
feat(env)!: replace Corepack with package manager shims #2391
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
Open
liangmiQwQ
wants to merge
3
commits into
voidzero-dev:main
Choose a base branch
from
liangmiQwQ:feat-breaking/remove-corepack-always-expose-pm-shims
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 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
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
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
10 changes: 0 additions & 10 deletions
10
crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/shim_corepack_bundled/snapshots.toml
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...cli_snapshots/fixtures/shim_corepack_bundled/snapshots/shim_corepack_bundled.md
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...hots/tests/cli_snapshots/fixtures/shim_corepack_enable_install_directory/fake-corepack.sh
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...pshots/tests/cli_snapshots/fixtures/shim_corepack_enable_install_directory/snapshots.toml
This file was deleted.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
...ck_enable_install_directory/snapshots/shim_corepack_enable_install_directory.md
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/shim_corepack_removed/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,6 @@ | ||
| [[case]] | ||
| name = "shim_corepack_removed" | ||
| vp = "global" | ||
| steps = [ | ||
| { argv = ["vp", "install", "-g", "corepack"], comment = "Corepack is no longer a managed global package", continue-on-failure = true }, | ||
| ] |
13 changes: 13 additions & 0 deletions
13
...cli_snapshots/fixtures/shim_corepack_removed/snapshots/shim_corepack_removed.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,13 @@ | ||
| # shim_corepack_removed | ||
|
|
||
| ## `vp install -g corepack` | ||
|
|
||
| Corepack is no longer a managed global package | ||
|
|
||
| **Exit code:** 1 | ||
|
|
||
| ``` | ||
| VITE+ - The Unified Toolchain for the Web | ||
|
|
||
| error: Failed to install corepack: 'vp install -g corepack' is no longer supported. | ||
| ``` |
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
2 changes: 1 addition & 1 deletion
2
..._snapshots/tests/cli_snapshots/fixtures/shim_pnpm_uses_project_node_version/.node-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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 22.12.0 | ||
| lts/* |
11 changes: 8 additions & 3 deletions
11
...snapshots/tests/cli_snapshots/fixtures/shim_pnpm_uses_project_node_version/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 |
|---|---|---|
| @@ -1,9 +1,14 @@ | ||
| [[case]] | ||
| name = "shim_pnpm_uses_project_node_version" | ||
| vp = "global" | ||
| local-registry = true | ||
| skip-platforms = ["windows"] | ||
| steps = [ | ||
| { argv = ["vp", "install", "-g", "pnpm"], comment = "Ensure pnpm is globally installed", snapshot = false, continue-on-failure = true }, | ||
| { argv = ["vp", "env", "exec", "node", "-v"], comment = "Node version resolved from .node-version", continue-on-failure = true }, | ||
| { argv = ["vp", "env", "exec", "pnpm", "exec", "node", "-v"], comment = "pnpm should use same project Node version", continue-on-failure = true }, | ||
| { argv = ["vp", "env", "exec", "node", "-v"], comment = "Node version resolved from .node-version" }, | ||
| { argv = ["pnpm", "--version"], comment = "The unpinned pnpm shim resolves the latest version", snapshot = false }, | ||
| { argv = ["pnpm", "--version"], envs = [["NPM_CONFIG_REGISTRY", "http://127.0.0.1:9"]], comment = "The unpinned shim reuses its fresh latest-version cache without registry access", snapshot = false }, | ||
| { argv = ["pnpm", "exec", "node", "-v"], comment = "pnpm should use same project Node version" }, | ||
| { argv = ["vp", "env", "exec", "--node", "22.13", "pnpm", "exec", "node", "-e", "if(!process.version.startsWith('v22.13.'))process.exit(1);console.log('explicit Node reaches pnpm child')"], comment = "Explicit env exec version overrides the project version through the pnpm shim" }, | ||
| { argv = ["vpt", "write-file", ".node-version", ">=999.0.0\n"], snapshot = false }, | ||
| { argv = ["pnpm", "--version"], envs = [["VP_NODE_DIST_MIRROR", "http://127.0.0.1:9"]], comment = "JS package-manager shims report project Node resolution failures", continue-on-failure = true }, | ||
| ] |
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.
The reason we previously chose corepack was because we were unsure what side effects would result from defaulting to create shims for pnpm, yarn, and bun.
This is because it would prevent users from installing pnpm or bun themselves once they have installed vp.
We may need to make some modifications in install.sh to prompt users whether they want vp to manage pnpm, yarn, bun, etc., rather than defaulting to overriding their installations.
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.
I thought about that, so now
vp env offcan control thepnpmbinary status like Node.js.I also plan to introduce partial control like
vp env off pmvp env on nodein the second PR.Uh oh!
There was an error while loading. Please reload this page.
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.
The first point, yes, but in order to divide the responsibilities, and reduce mixed up logic, the architecture requires Vite+ offers full control underlying package manager.
And since
vp envwill manage package managers soon, there are no problems if they want to install their own package managers.