refactor(installer): unify Vite+ setup into the global cli - #2611
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 072785da3c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95c99baec5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 013777b09d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
One left problem might be #1338 (comment), but it is not a big deal, this PR already copies the original behavior, this could be reconsidered after this merged. |
Registry bridge build (
|
| Package | Version |
|---|---|
vite-plus |
0.0.0-commit.2e234c9c09eee604f13ad42c8252d329a3f31acd |
@voidzero-dev/vite-plus-core |
0.0.0-commit.2e234c9c09eee604f13ad42c8252d329a3f31acd |
Install the Vite+ CLI built from this commit, then migrate a project:
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/liangmiQwQ/vite-plus/2e234c9c09eee604f13ad42c8252d329a3f31acd/packages/cli/install.sh | VP_PR_VERSION=2611 bash# Windows (PowerShell)
$env:VP_PR_VERSION="2611"; irm https://raw.githubusercontent.com/liangmiQwQ/vite-plus/2e234c9c09eee604f13ad42c8252d329a3f31acd/packages/cli/install.ps1 | iexOr download the standalone Windows installer built from this commit:
| Architecture | Installer |
|---|---|
| x64 | vp-setup-x86_64-pc-windows-msvc.exe |
| Arm64 | vp-setup-aarch64-pc-windows-msvc.exe |
GitHub requires you to sign in and downloads each installer as a ZIP artifact. Extract vp-setup.exe, then run it against this preview build:
.\vp-setup.exe --version "0.0.0-commit.2e234c9c09eee604f13ad42c8252d329a3f31acd" --registry "https://registry-bridge.viteplus.dev/"After installing, upgrade the current project's vite-plus to this test build with:
vp migrateOr point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:
| Package manager | Registry config |
|---|---|
| npm / pnpm / Bun | .npmrc: registry=https://registry-bridge.viteplus.dev/ |
| Yarn (v2+) | .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/" |
Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):
{
"devDependencies": {
"vite-plus": "0.0.0-commit.2e234c9c09eee604f13ad42c8252d329a3f31acd",
"vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.2e234c9c09eee604f13ad42c8252d329a3f31acd"
}
}
I still have a local commit, it will be ready really soon and then you can merge it if there is no problem. |
|
@fengmk2 I'm ready for this. |
| if ! "$vp_bin" env on > /dev/null 2>&1; then | ||
| warn "Failed to record environment management preference." | ||
| fi | ||
| run_legacy_installer "$binary_source" |
There was a problem hiding this comment.
@fengmk2 The legacy script is for when VP_VERSION is set to an old release that doesn't have self-setup feature.
The time to remove that depends on when we decide to stop supporting installing these legacy release
…in APIs (#2692) `vp env use` now sets each package manager's version independently. This release also adds Oxlint plugin APIs and fixes migration, installation, and template extraction. ### Breaking Changes #### Package-manager overrides Direct package-manager commands no longer use `VP_PACKAGE_MANAGER`. Use the matching version variable in shell profiles, CI jobs, and Dockerfiles: | Previous override for a direct command | New override | | --- | --- | | `VP_PACKAGE_MANAGER=npm@<version>` | `VP_NPM_VERSION=<version>` | | `VP_PACKAGE_MANAGER=pnpm@<version>` | `VP_PNPM_VERSION=<version>` | | `VP_PACKAGE_MANAGER=yarn@<version>` | `VP_YARN_VERSION=<version>` | | `VP_PACKAGE_MANAGER=bun@<version>` | `VP_BUN_VERSION=<version>` | `VP_PACKAGE_MANAGER` still selects the manager and version for `vp install` and related commands. `vp env use pnpm@10` now changes only the direct pnpm commands. To override `vp install`, set `VP_PACKAGE_MANAGER` explicitly. The old `.session-package-manager` file is no longer read or migrated. Run `vp env use` again to create the new session files. Projects that use only project pins or global defaults need no changes. See the [environment guide](https://viteplus.dev/guide/env) ([#2658](#2658), [#2659](#2659)), by @liangmiQwQ. #### Installer preferences `VP_NODE_MANAGER` now controls only Node.js. Existing installations retain saved preferences during upgrades, so `vp upgrade` needs no configuration changes. For scripted installations, set `VP_PM_MANAGER` to apply the same choice to package managers: | Previous combined setting | New combined setting | | --- | --- | | `VP_NODE_MANAGER=no` | `VP_NODE_MANAGER=no VP_PM_MANAGER=no` | | `VP_NODE_MANAGER=yes` | `VP_NODE_MANAGER=yes VP_PM_MANAGER=yes` | Update installer commands in CI jobs and Dockerfiles. Use `VP_NPM_MANAGER`, `VP_PNPM_MANAGER`, `VP_YARN_MANAGER`, or `VP_BUN_MANAGER` for individual preferences. The interactive prompt retains its combined choice. See the [installer variables guide](https://viteplus.dev/guide/installer-env-vars) ([#2681](#2681)), by @liangmiQwQ. #### Vite DevTools Projects that install `@vitejs/devtools` must update its dependency range from `^0.4.0 || ^0.5.0` to `^0.7.1`. Projects without this optional dependency need no changes. This requirement comes with the Vite upgrade listed below. ### Highlights - Installers and `vp upgrade` share setup behavior across platforms, which simplifies maintenance. The installers retain support for older releases ([#2611](#2611)), by @liangmiQwQ. - Custom Oxlint rules can import their APIs from `vite-plus/lint/plugins` and `vite-plus/lint/plugins-dev`. `vp migrate` updates supported existing imports ([#2328](#2328)), by @fengmk2. - `vp install` and `vp add` now honor `--ignore-scripts` for named packages and managed global installations ([#2682](#2682)), by @jong-kyung. - `vp create` rejects malformed registry versions that could place organization template files outside the cache directory ([#2665](#2665)), by @fengmk2. ### Features - The bundled tools update from `vite@8.2.2` to `vite@8.3.0` and from `rolldown@1.2.7` to `rolldown@1.2.8`. They also update from `oxlint@1.81.0` to `oxlint@1.82.0` and from `oxfmt@0.66.0` to `oxfmt@0.67.0`. The new linter and formatter can flag code that passed before. Run `vp fmt` after the upgrade if CI runs `vp check` ([#2670](#2670)), by @fengmk2. ### Fixes & Enhancements - `vp env pin` updates an active local `.nvmrc` and preserves its comments. Use `--target nvmrc` to select this file explicitly ([#2676](#2676)), by @ywenhao. - `vp migrate` reports unsupported ESLint rules that it skips, so users can review the missing checks ([#2689](#2689)), by @yusuke99. - `vp migrate` imports leftover tsdown configuration when a project already uses Vite+ ([#2646](#2646)), by @TheAlexLichter. - `vp migrate` accepts single-line JSON formatter configuration with a final newline ([#2643](#2643)), by @TheAlexLichter. - `vp migrate` avoids a redundant `playwright` dependency when the project already declares `@playwright/test` ([#2637](#2637)), by @yusuke99. - Newly scaffolded local generators honor `--no-interactive` and report missing arguments without prompts. Existing generators need the updated entrypoint ([#2677](#2677)), by @SaKaNa-Y. - `vp upgrade` installs its dependencies correctly when the installation directory is inside a pnpm workspace ([#2644](#2644)), by @fengmk2. - Nested package-manager commands retain the selected Node runtime and package-manager versions ([#2631](#2631)), by @lyzno1. - Built-in tools reuse the Node executable that starts the CLI. Editor lint and format servers work when `node` is absent from `PATH` ([#2673](#2673)), by @fengmk2. - The npm command wrapper enables Node's compile cache before it loads the CLI, which reduces repeated startup work ([#2648](#2648)), by @pablog12. - Package-manager commands suppress pnpm, npm, and supported Yarn update notices. Yarn 4 daily tips are also hidden ([#2649](#2649), [#2650](#2650), [#2651](#2651)), by @fengmk2. - Invalid `package.json` errors include the affected file's path ([#2683](#2683)), by @adamaveray. ### Docs - The README task example uses the supported `env` field ([#2653](#2653)), by @SaKaNa-Y. - Migration guidance tells pnpm users to retain the generated `vite` and `vitest` dependencies ([#2660](#2660)), by @naokihaba. - Lint and format guides explain root configuration and overrides for monorepos. They clarify that nested configuration is not supported ([#2668](#2668)), by @liangmiQwQ. ### Chore - The repository removes unused Babel dependencies and the unused hooks directory setter ([#2634](#2634), [#2647](#2647)), by @jong-kyung. - CLI snapshot tests run across parallel jobs, and the pnpm 11 workspace pack test excludes generated archives ([#2657](#2657), [#2655](#2655)), by @fengmk2. - CI removes the unused Graphite optimization and adds Solid 2 ecosystem coverage ([#2678](#2678), [#2680](#2680)), by @fengmk2. - Release guidance clarifies validation and announcement procedures ([#2633](#2633)), by @fengmk2. - The runtime manager refreshes the signing keys for Node.js release verification ([#2687](#2687)), by @voidzero-guard[bot]. ### Bundled Versions | Tool | Version | Source | | --- | --- | --- | | `vite` | `8.3.0` | [`434e8e9`](vitejs/vite@434e8e9) | | `rolldown` | `1.2.8` | [`9704b56`](rolldown/rolldown@9704b56) | | `tsdown` | `0.23.0` | [npm](https://npmx.dev/package/tsdown/v/0.23.0) | | `vitest` | `4.1.11` | [npm](https://npmx.dev/package/vitest/v/4.1.11) | | `oxlint` | `1.82.0` | [npm](https://npmx.dev/package/oxlint/v/1.82.0) | | `oxlint-tsgolint` | `7.0.2001` | [npm](https://npmx.dev/package/oxlint-tsgolint/v/7.0.2001) | | `oxfmt` | `0.67.0` | [npm](https://npmx.dev/package/oxfmt/v/0.67.0) | ### Upgrade ```bash vp upgrade ``` ### New Contributors @yusuke99, @pablog12, @SaKaNa-Y, @ywenhao, @adamaveray **Full Changelog**: v0.3.1...v0.3.2 --- Merging this PR will trigger the release workflow. --------- Co-authored-by: voidzero-guard[bot] <278573678+voidzero-guard[bot]@users.noreply.github.com> Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
Close #2406
Close #2338
Close #2170
Bash installer, PowerShell installer,
vp-setup.exe, andvp upgradenow share the target binary's setup code. Moving installation logic intovpreduces duplication and platform differences, and lets each new version own its setup changes.Installers download and verify the target, then let it install itself. A completion marker makes setup run on first launch and retry after failure. This also lets old
vp upgradereach the new setup through its existingvp env setup --refreshcall, while keeping its download and activation flow.Setup always creates
vpxandvprshims, usessystem-firstmode when users decline Node.js management, and reports failures back to the installers.Installers probe for self-setup support and fall back to the legacy implementations for older targets. Keeping those legacy installers accounts for the net line increase, even though the new scripts are much smaller (reduce more than 2500 line).
Here, “new” and “old” refer to the installers and
vpimplementations after and before this change. This PR does not changesetup-vp. 🟢 indicates a supported compatibility path; it does not imply that every historical version combination has been tested.current, and shims.vpvite-plus-self-setup-v1, then hands installation over to the target binary.vpvpenv setupinvocation triggers the new binary’s first-start setup.vp upgrade→ newvpenv setup --refreshcall triggers in-place setup, preserving configuration and rollback history.vp upgrade→ newvp, including same-version reinstallscurrentand refreshes the environment throughenv setup --refresh.setup-vpcalling the new install script~/.vite-plus, keeping PATH consistent.vp-setup.exe→ versions 0.3.0 and later🤖 Generated with Codex