Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,6 @@ jobs:
- name: varlet
node-version: 22
command: |
# scripts/bootstrap.mjs spawns `pnpm build` via tinyexec and needs
# pnpm on PATH (not exposed by the vp install itself). corepack
# enable creates a pnpm launcher in the vp bin dir that resolves
# the project's pinned packageManager version (pnpm@9.15.9).
corepack enable
node scripts/bootstrap.mjs
# Report-only: oxlint 1.68.0 surfaces ts1038 ("A 'declare' modifier
# cannot be used in an already ambient context.") on varlet's
Expand Down
4 changes: 2 additions & 2 deletions crates/vp_cli_snapshots/tests/cli_snapshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ A step is a bare argv array or a table:

`argv[0]` may be `vpt`, a runner-provisioned tool such as `nu`, or any
executable exposed by the case's Vite+ installation, including default shims
such as `vp`, `node`, and `corepack` and globally installed package binaries.
There is no shell: no `&&`, no
such as `vp`, `node`, `npm`, and `pnpm` and globally installed package
binaries. There is no shell: no `&&`, no
redirects, no globs. File setup and assertions go through `vpt` so behavior
is identical on every platform:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ Inspect:

Examples:
Setup:
vp env setup # Create shims for node, npm, npx, corepack
vp env setup # Create Node.js and package-manager shims
vp env on # Use vite-plus managed Node.js
vp env print # Print shell snippet for this session

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@ import fs from 'node:fs';
import path from 'node:path';

const expected = path.resolve('external/vp');
const shims = [
'vp',
'node',
'npm',
'npx',
'pnpm',
'pnpx',
'yarn',
'yarnpkg',
'bun',
'bunx',
'vpx',
'vpr',
];

for (const shim of ['vp', 'node', 'npm', 'npx', 'corepack', 'vpx', 'vpr']) {

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

I thought about that, so now vp env off can control the pnpm binary status like Node.js.

I also plan to introduce partial control like vp env off pm vp env on node in the second PR.

@liangmiQwQ liangmiQwQ Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

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.

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 env will manage package managers soon, there are no problems if they want to install their own package managers.

for (const shim of shims) {
const shimPath = path.join('home', 'bin', shim);
const target = fs.readlinkSync(shimPath);
if (target !== expected) {
throw new Error(`${shim} points to ${target}, expected ${expected}`);
}
}

const actualShims = fs.readdirSync(path.join('home', 'bin')).sort();
if (actualShims.join() !== [...shims].sort().join()) {
throw new Error(`unexpected shims: ${actualShims.join(', ')}`);
}

console.log('all shims point to external vp');
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ vp = "global"
local-registry = true
skip-platforms = ["windows"]
steps = [
{ argv = ["vp", "remove", "-g", "corepack"], snapshot = false, continue-on-failure = true },
{ argv = ["vp", "env", "exec", "node", "--version"], comment = "Ensure Node.js is installed first", continue-on-failure = true },
{ argv = ["vp", "env", "which", "node"], comment = "Core tool - shows resolved Node.js binary path", continue-on-failure = true },
{ argv = ["vp", "env", "which", "npm"], comment = "Core tool - shows resolved npm binary path", continue-on-failure = true },
{ argv = ["vp", "env", "which", "npx"], comment = "Core tool - shows resolved npx binary path", continue-on-failure = true },
{ argv = ["vp", "env", "which", "corepack"], comment = "Core tool - corepack bundled with the resolved Node.js", continue-on-failure = true },
{ argv = ["vp", "install", "-g", "cowsay@1.6.0"], comment = "Install a global package via vp", continue-on-failure = true },
{ argv = ["vp", "env", "which", "cowsay"], comment = "Global package - shows binary path with metadata", continue-on-failure = true },
{ argv = ["vp", "remove", "-g", "cowsay"], comment = "Cleanup", continue-on-failure = true },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# command_env_which

## `vp remove -g corepack`

**Exit code:** 1

```
Failed to uninstall corepack: Package corepack is not installed
```

## `vp env exec node --version`

Ensure Node.js is installed first
Expand Down Expand Up @@ -52,18 +44,6 @@ VITE+ - The Unified Toolchain for the Web
Source: <workspace>/.node-version
```

## `vp env which corepack`

Core tool - corepack bundled with the resolved Node.js

```
VITE+ - The Unified Toolchain for the Web

<home>/.vite-plus/js_runtime/node/<version>/bin/corepack
Version: 20.18.0
Source: <workspace>/.node-version
```

## `vp install -g cowsay@1.6.0`

Install a global package via vp
Expand Down Expand Up @@ -108,6 +88,6 @@ Unknown tool - error message
VITE+ - The Unified Toolchain for the Web

error: tool 'unknown-tool' not found
Not a core tool (node, npm, npx, corepack) or installed global package.
Not a core tool (node, npm, npx) or installed global package.
Run 'vp list -g' to see installed packages.
```

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

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 },
]
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.
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ local-registry = true
skip-platforms = ["windows"]
comment = "pnpm 12 ships a native binary via @pnpm/exe.* platform packages; the pnpm shim runs it directly and the pnpx shim injects the dlx subcommand."
steps = [
{ argv = ["vp", "install", "-g", "pnpm"], comment = "Expose the pnpm/pnpx shims", snapshot = false, continue-on-failure = true },
{ argv = ["vp", "install", "-g", "pnpm"], comment = "Reject the redundant managed global install", continue-on-failure = true },
{ argv = ["vpt", "stat-file", "$VP_HOME/packages/pnpm.json", "--assert", "missing"], comment = "The redundant package should not be installed", snapshot = false, continue-on-failure = true },
{ argv = ["vp", "env", "exec", "node", "--version"], comment = "Ensure Node.js is installed first", snapshot = false, continue-on-failure = true },
{ argv = ["pnpm", "--version"], comment = "pnpm shim downloads the native binary and resolves the pinned packageManager version (12.0.0-beta.0)", continue-on-failure = true },
{ argv = ["pnpx", "--silent", "cowsay", "hello"], comment = "pnpx shim injects dlx so the native binary runs the package", continue-on-failure = true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ pnpm 12 ships a native binary via @pnpm/exe.* platform packages; the pnpm shim r

## `vp install -g pnpm`

Expose the pnpm/pnpx shims
Reject the redundant managed global install

```
VITE+ - The Unified Toolchain for the Web

warn: Vite+ already includes 'pnpm'; skipping.
```

## `vpt stat-file $VP_HOME/packages/pnpm.json --assert missing`

The redundant package should not be installed


## `vp env exec node --version`
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.12.0
lts/*
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 },
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# shim_pnpm_uses_project_node_version

## `vp install -g pnpm`

Ensure pnpm is globally installed


## `vp env exec node -v`

Node version resolved from .node-version
Expand All @@ -13,10 +8,46 @@ Node version resolved from .node-version
<version>
```

## `vp env exec pnpm exec node -v`
## `pnpm --version`

The unpinned pnpm shim resolves the latest version


## `NPM_CONFIG_REGISTRY=http://127.0.0.1:9 pnpm --version`

The unpinned shim reuses its fresh latest-version cache without registry access


## `pnpm exec node -v`

pnpm should use same project Node version

```
Already up to date

Done in <duration> using pnpm <version>
<version>
```

## `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'\'')'`

Explicit env exec version overrides the project version through the pnpm shim

```
explicit Node reaches pnpm child
```

## `vpt write-file .node-version '>=999.0.0
'`


## `VP_NODE_DIST_MIRROR=http://127.0.0.1:9 pnpm --version`

JS package-manager shims report project Node resolution failures

**Exit code:** 1

```
vp: Failed to resolve Node version: Failed to download Node.js runtime: No version matching '>=999.0.0' found
vp: Run 'vp env doctor' for diagnostics
```
Loading
Loading