From 4fb9c035620bae15451ae93d8729410a926277f8 Mon Sep 17 00:00:00 2001 From: MK Date: Wed, 19 Aug 2026 00:55:17 +0800 Subject: [PATCH 1/5] test: reproduce automatic Node.js resolution --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ddf7fe..39d30bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -126,6 +126,39 @@ jobs: echo "$ACTUAL" | grep -q "^v${{ matrix.node-version }}\." || (echo "Expected Node.js v${{ matrix.node-version }}.x but got $ACTUAL" && exit 1) fi + # Reproduces https://github.com/voidzero-dev/setup-vp/issues/128: with no + # explicit Node.js input, the managed `node` shim should use Vite+'s normal + # project resolution and honor package.json#devEngines.runtime. + test-auto-node-version: + runs-on: ubuntu-latest + steps: + - uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2 + + - name: Create project with devEngines.runtime + shell: bash + run: | + DIR="${RUNNER_TEMP//\\//}/test-project" + mkdir -p "$DIR" + echo '{"name":"test-project","private":true,"devEngines":{"runtime":{"name":"node","version":"22.18.0"}}}' > "$DIR/package.json" + + - name: Setup Vite+ without a Node.js input + uses: ./ + with: + working-directory: ${{ runner.temp }}/test-project + run-install: false + cache: false + + - name: Verify project Node.js version + working-directory: ${{ runner.temp }}/test-project + shell: bash + run: | + ACTUAL=$(node --version) + echo "Node.js version: $ACTUAL" + if [ "$ACTUAL" != "v22.18.0" ]; then + echo "::error::expected Node.js v22.18.0 from devEngines.runtime, got $ACTUAL" + exit 1 + fi + # End-to-end check of node-manager: false. The installer must skip # node/npm/npx/corepack shim creation (VP_NODE_MANAGER=no) and the action # must run `vp env off`, so vp commands resolve the Node.js already on the From 5d4cabdaffeb2f25a9153f861f912fe83a9ca8fd Mon Sep 17 00:00:00 2001 From: MK Date: Wed, 19 Aug 2026 10:12:45 +0800 Subject: [PATCH 2/5] docs: clarify automatic Node.js resolution --- README.md | 4 +++- action.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1e6990..19886bd 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ jobs: | ----------------------- | ----------------------------------------------------------------------------------------------------------- | -------- | ---------------- | | `version` | Version of Vite+ to install. Takes precedence over `version-file` | No | auto / `latest` | | `version-file` | Path to a file to resolve the Vite+ version from (`package.json`, `pnpm-workspace.yaml`, or `.yarnrc.yml`) | No | | -| `node-version` | Node.js version to install via `vp env use` | No | Latest LTS | +| `node-version` | Node.js version to install via `vp env use` | No | Vite+ resolution | | `node-version-file` | Path to file containing Node.js version (`.nvmrc`, `.node-version`, `.tool-versions`, `package.json`) | No | | | `node-manager` | Control Vite+'s Node.js manager: `false` keeps the runner's Node.js, `true` force-enables the managed one | No | Auto (on for CI) | | `working-directory` | Project directory used for relative paths, lockfile auto-detection, environment checks, and default install | No | Workspace root | @@ -345,6 +345,8 @@ jobs: When `working-directory` is set, relative `run-install.cwd`, `node-version-file`, `version-file`, and `cache-dependency-path` values are resolved from that directory. +Omitting both `node-version` and `node-version-file` leaves the session without an override. With the Vite+ Node.js manager enabled, its shims search the current directory and its parents for `.node-version`, `package.json#devEngines.runtime`, `package.json#engines.node`, and `.nvmrc`, in that order. If the project does not declare a version, Vite+ uses its global default and then latest LTS. + `node-manager: false` skips Node.js shim creation and runs `vp env off`, so `vp` commands prefer the Node.js already on `PATH`. It cannot be combined with `node-version` or `node-version-file`. ## Outputs diff --git a/action.yml b/action.yml index d695c92..2698ccc 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ inputs: required: false default: "false" node-version: - description: "Node.js version to install via `vp env use`. Defaults to Node.js latest LTS version." + description: "Node.js version to install via `vp env use`. Omit this input and node-version-file to let Vite+ resolve the version from the project, then its global default, then latest LTS." required: false node-version-file: description: "Path to file containing the Node.js version spec (.nvmrc, .node-version, .tool-versions, package.json). Ignored when node-version is specified." From bcd8890876ff1f6503c76f5b71cd05273aedb7e7 Mon Sep 17 00:00:00 2001 From: MK Date: Wed, 19 Aug 2026 10:37:00 +0800 Subject: [PATCH 3/5] docs: define the Vite+ user-level default --- README.md | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 19886bd..0daed47 100644 --- a/README.md +++ b/README.md @@ -345,7 +345,7 @@ jobs: When `working-directory` is set, relative `run-install.cwd`, `node-version-file`, `version-file`, and `cache-dependency-path` values are resolved from that directory. -Omitting both `node-version` and `node-version-file` leaves the session without an override. With the Vite+ Node.js manager enabled, its shims search the current directory and its parents for `.node-version`, `package.json#devEngines.runtime`, `package.json#engines.node`, and `.nvmrc`, in that order. If the project does not declare a version, Vite+ uses its global default and then latest LTS. +Omitting both `node-version` and `node-version-file` leaves the session without an override. With the Vite+ Node.js manager enabled, its shims search the current directory and its parents for `.node-version`, `package.json#devEngines.runtime`, `package.json#engines.node`, and `.nvmrc`, in that order. If the project does not declare a version, Vite+ uses the user-level default. Set this default with `vp env default `. Vite+ stores this setting under `VP_HOME` (`~/.vite-plus` by default). If no user-level default exists, Vite+ uses the latest LTS release. `node-manager: false` skips Node.js shim creation and runs `vp env off`, so `vp` commands prefer the Node.js already on `PATH`. It cannot be combined with `node-version` or `node-version-file`. diff --git a/action.yml b/action.yml index 2698ccc..55050bf 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ inputs: required: false default: "false" node-version: - description: "Node.js version to install via `vp env use`. Omit this input and node-version-file to let Vite+ resolve the version from the project, then its global default, then latest LTS." + description: "Node.js version to install via `vp env use`. Omit this input and node-version-file to let Vite+ resolve the version. `vp env default ` sets the user-level default. Vite+ checks the project, this default, and then the latest LTS release." required: false node-version-file: description: "Path to file containing the Node.js version spec (.nvmrc, .node-version, .tool-versions, package.json). Ignored when node-version is specified." From 1f1d87d355037825d633a8e2e6999b79e9626cd9 Mon Sep 17 00:00:00 2001 From: MK Date: Wed, 19 Aug 2026 10:37:33 +0800 Subject: [PATCH 4/5] docs: avoid the Vite+ default storage path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0daed47..3e6ab0e 100644 --- a/README.md +++ b/README.md @@ -345,7 +345,7 @@ jobs: When `working-directory` is set, relative `run-install.cwd`, `node-version-file`, `version-file`, and `cache-dependency-path` values are resolved from that directory. -Omitting both `node-version` and `node-version-file` leaves the session without an override. With the Vite+ Node.js manager enabled, its shims search the current directory and its parents for `.node-version`, `package.json#devEngines.runtime`, `package.json#engines.node`, and `.nvmrc`, in that order. If the project does not declare a version, Vite+ uses the user-level default. Set this default with `vp env default `. Vite+ stores this setting under `VP_HOME` (`~/.vite-plus` by default). If no user-level default exists, Vite+ uses the latest LTS release. +Omitting both `node-version` and `node-version-file` leaves the session without an override. With the Vite+ Node.js manager enabled, its shims search the current directory and its parents for `.node-version`, `package.json#devEngines.runtime`, `package.json#engines.node`, and `.nvmrc`, in that order. If the project does not declare a version, Vite+ uses the user-level default. Set this default with `vp env default `. If no user-level default exists, Vite+ uses the latest LTS release. `node-manager: false` skips Node.js shim creation and runs `vp env off`, so `vp` commands prefer the Node.js already on `PATH`. It cannot be combined with `node-version` or `node-version-file`. From 20c0bb65ddcc7824536775292b74eeac3a018be0 Mon Sep 17 00:00:00 2001 From: MK Date: Wed, 19 Aug 2026 10:50:05 +0800 Subject: [PATCH 5/5] docs: clarify Node.js resolution directory --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3e6ab0e..c2e1c21 100644 --- a/README.md +++ b/README.md @@ -347,6 +347,8 @@ When `working-directory` is set, relative `run-install.cwd`, `node-version-file` Omitting both `node-version` and `node-version-file` leaves the session without an override. With the Vite+ Node.js manager enabled, its shims search the current directory and its parents for `.node-version`, `package.json#devEngines.runtime`, `package.json#engines.node`, and `.nvmrc`, in that order. If the project does not declare a version, Vite+ uses the user-level default. Set this default with `vp env default `. If no user-level default exists, Vite+ uses the latest LTS release. +`working-directory` applies to the action. Each later workflow step keeps its own working directory. Vite+ searches for Node.js version sources from each command's current working directory. For a subproject, set `working-directory` on the step that runs `node` or `vp`. + `node-manager: false` skips Node.js shim creation and runs `vp env off`, so `vp` commands prefer the Node.js already on `PATH`. It cannot be combined with `node-version` or `node-version-file`. ## Outputs