Commit 327d23a
authored
feat(migrate): upgrade existing Vite+ projects across versions (#1891)
RFC: `rfcs/migrate-existing-projects.md`
## Problem
`vp migrate` on an existing v0.1.x Vite+ project did not upgrade
cleanly: it delegated to the stale local CLI, left `pnpm-workspace.yaml`
overrides and catalogs pinning `vite`/`vitest` to old versions, and
skewed coverage providers. The v0.2.x release notes currently tell users
not to run `vp migrate` yet.
## What it does
- **Routing**: when the local `vite-plus` is older than the global `vp`,
run migrate from the global CLI so the stale local CLI does not run.
- **Re-pin** `vite-plus` and the `vite` ->
`@voidzero-dev/vite-plus-core` alias off 0.1.x, across dependencies,
overrides/resolutions, and catalogs, for every workspace package rather
than only the root manifest.
- **vitest by usage**: removed in the common case (vite-plus provides it
transitively), kept and ecosystem-aligned when a package uses it
directly or via a range-peer integration; align `@vitest/*`
(coverage-v8/-istanbul, ui, web-worker) to the bundled version, with the
browser providers kept opt-in.
- **pnpm bootstrap**: move `package.json#pnpm` settings into
`pnpm-workspace.yaml`, fix the empty `"pnpm": {}` misrouting that left
stale overrides, inject the direct `vite` edge where pnpm needs it, and
approve required build scripts. The "pending" check scans every
workspace package's catalog ref, so a package pinned to a stale named
catalog (`catalog:legacy`) is not missed.
- **Plugin packages**: preserve real `vite`/`vitest` imports in
`vite-plugin-*` and unplugin packages instead of rewriting them to
`vite-plus`.
- **Summary**: the migrate output leads with `Updated . to Vite+
<version>` (or `Migrated` for a fresh project) and lists the toolchain
version changes as a `from -> to` table for `vite-plus`, the raw `vite`
version, and `vitest` when present.
- **Progress**: on a large monorepo the per-package config-compatibility
check reports live progress (`Checking config compatibility (N/total):
<package>`), so the spinner keeps moving and shows what it is processing
instead of stalling on a stale message.
## Version-only by default, `--full` for setup
On an existing Vite+ project, `vp migrate` does the toolchain version
upgrade above and **silently skips the first-time setup bucket** (git
hooks, editor config, agent files, ESLint/Prettier migration, framework
shims, tsconfig `baseUrl`, and `.nvmrc`/Volta to `.node-version`), so a
version bump does not re-touch things you already set up. Pass `--full`
to run the whole setup, or a per-action flag (`--hooks` / `--agent` /
`--editor`) to opt into a single action. A bare upgrade that left setup
actions on the table hints at `vp migrate --full`. Fresh (non Vite+)
projects always run the full migration.
```console
# default: toolchain version upgrade only
$ vp migrate --no-interactive
◇ Updated . to Vite+ 0.2.1
• Node 22.18.0 pnpm 10.18.0
• Dependencies:
vite-plus 0.1.21 → 0.2.1
vite → 8.1.0
• Package manager settings configured
• Skipped editor, hooks, and lint setup. Run `vp migrate --full` to apply them.
# --full: upgrade plus the setup bucket
$ vp migrate --full --no-interactive
◇ Updated . to Vite+ 0.2.1
• Node 22.18.0 pnpm 10.18.0
• Dependencies:
vite-plus 0.1.21 → 0.2.1
vite → 8.1.0
• 2 config updates applied
• Node version manager file migrated to .node-version
• Package manager settings configured
# --hooks: upgrade plus a single setup action (no --full)
$ vp migrate --hooks --no-interactive
◇ Updated . to Vite+ 0.2.1
• Node 22.18.0 pnpm 10.18.0
• Dependencies:
vite-plus 0.1.21 → 0.2.1
vite → 8.1.0
• Git hooks configured
• Package manager settings configured
```
On a large monorepo the spinner walks the per-package
config-compatibility check, so the run is never silent:
```console
◒ Checking config compatibility (7/42): examples/tpr-demo
◒ Checking config compatibility (23/42): tests/fixtures/pages-basic
◒ Checking config compatibility (40/42): tests/fixtures/ecosystem/next-themes
```
## Node.js version
The native binding runs on any Node `>=20.0.0`, and the published
`@voidzero-dev/vite-plus-*` platform packages now declare that ABI floor
(the `vite-plus` and core packages keep their wider `engines.node`
support range). So a Node pin whose floor is below the support range but
at or above `20.0.0` (`engines.node: 24.x`, `>=22`, `.node-version`
`24.3.0`, ...) still installs the native binding and is left untouched
by migration. Converting `.nvmrc` and Volta `volta.node` to
`.node-version` (and repointing any `actions/setup-node`
`node-version-file: .nvmrc` reference in workflows and composite
actions, `.github/actions/**/action.{yml,yaml}`, so CI does not break)
is part of the `--full` setup, not the default upgrade.
## Manual pkg.pr.new testing
Install an isolated pkg.pr.new global CLI and run the PR's `vp migrate`
against a local project. Dependencies resolve through the registry
bridge as ordinary `0.0.0-commit.<sha>` versions, persisted into the
project's `.npmrc` (and `.yarnrc.yml` for Yarn Berry) so its own CI
installs the same build:
```bash
./.github/scripts/test-pkg-pr-new-migrate.sh 1891 /path/to/project [--no-interactive]
```
The first argument accepts a PR number or commit SHA. The helper keeps
`~/.vite-plus` untouched, forces migration through the preview CLI even
when the project has a same-version local CLI, clears only the workspace
root lockfile and `node_modules` before migrating, and refuses dirty Git
worktrees unless `ALLOW_DIRTY=1`. Confirm the result with `vp why -r
vite-plus vite vitest` (each must resolve to a single version).1 parent ff70707 commit 327d23a
404 files changed
Lines changed: 21071 additions & 7506 deletions
File tree
- .claude/skills
- test-pkg-pr-new-migrate
- verify-interactive-cli
- .github
- scripts
- workflows
- crates
- vite_global_cli/src
- commands
- vite_js_runtime/src
- providers
- vite_migration/src
- docs/guide
- ecosystem-ci
- packages
- cli
- binding
- src
- snap-tests-global
- command-upgrade-check
- migration-add-git-hooks
- migration-agent-claude
- migration-already-vite-plus-with-husky-hookspath
- migration-already-vite-plus-with-husky-lint-staged
- migration-already-vite-plus
- migration-auto-create-vite-config
- migration-baseurl-tsconfig
- migration-bunfig-inline-array
- migration-bunfig-missing
- migration-bunfig-no-install-section
- migration-chained-lint-staged-pre-commit
- migration-check
- migration-composed-husky-custom-dir
- migration-composed-husky-prepare
- migration-env-prefix-lint-staged
- migration-eslint-jsplugins-orphan-strip
- migration-eslint-jsplugins-preserve
- migration-eslint-legacy-already-vite-plus
- migration-eslint-legacy
- migration-eslint-lint-staged-mjs
- migration-eslint-lint-staged
- migration-eslint-lintstagedrc
- migration-eslint-monorepo-package-only
- migration-eslint-monorepo-plugins-in-packages
- migration-eslint-monorepo
- migration-eslint-npx-wrapper
- migration-eslint-nuxt-skip
- migration-eslint-plugins-cleanup
- migration-eslint-rerun-dual-config
- migration-eslint-rerun-mjs
- migration-eslint-rerun
- migration-eslint-type-aware
- migration-eslint
- migration-existing-husky-lint-staged
- migration-existing-husky-v8-hooks
- migration-existing-husky-v8-multi-hooks
- migration-existing-husky
- migration-existing-lint-staged-config
- migration-existing-pnpm-exec-lint-staged
- migration-existing-pre-commit
- migration-existing-prepare-script
- migration-framework-shim-astro-vue
- migration-framework-shim-astro
- migration-framework-shim-vue
- migration-from-tsdown-json-config
- migration-from-tsdown
- migration-from-vitest-config
- migration-from-vitest-files
- migration-hooks-skip-on-existing-hookspath
- migration-husky-catalog-version
- migration-husky-env-skip
- migration-husky-latest-dist-tag-v9-installed
- migration-husky-latest-dist-tag
- migration-husky-or-prepare
- migration-husky-semicolon-prepare
- migration-husky-v8-preserves-lint-staged
- migration-lazy-plugins-await
- migration-lint-staged-in-scripts
- migration-lint-staged-merge-fail
- migration-lint-staged-ts-config
- migration-lintstagedrc-json
- migration-lintstagedrc-merge-fail
- migration-lintstagedrc-not-support
- migration-lintstagedrc-staged-exists
- migration-merge-vite-config-js
- migration-merge-vite-config-ts
- migration-monorepo-bun
- migration-monorepo-husky-v8-preserves-lint-staged
- migration-monorepo-pnpm-overrides-dependency-selector
- migration-monorepo-pnpm
- migration-monorepo-root-vitest-adjacent
- migration-monorepo-skip-vite-peer-dependency
- migration-monorepo-yarn4
- migration-no-agent
- migration-no-git-repo
- migration-no-hooks-with-husky
- migration-no-hooks
- migration-npmx-dev
- migration-nvmrc-lts
- migration-nvmrc-node-alias
- migration-nvmrc
- migration-other-hook-tool
- migration-oxlintrc-json-with-comments
- migration-oxlintrc-jsonc
- migration-partially-installed-vite-plus
- migration-partially-migrated-pre-commit
- migration-pre-commit-env-setup
- migration-preserve-below-policy-node-pins
- migration-preserve-plugin-vite-import
- packages
- app
- src
- unplugin-demo
- src
- vite-plugin-demo
- migration-preserves-existing-fmt-and-lint
- migration-prettier-eslint-combo
- migration-prettier-ignore-unknown
- migration-prettier-lint-staged
- migration-prettier-pkg-json
- migration-prettier-rerun
- migration-prettier
- migration-rewrite-declare-module
- migration-rewrite-reference-types
- migration-skip-vite-dependency
- migration-skip-vite-peer-dependency
- migration-standalone-npm
- migration-standalone-pnpm
- migration-standalone-yarn-below-catalog
- migration-standalone-yarn4-idempotent
- migration-subpath
- migration-tsconfig-esmoduleinterop
- migration-upgrade-browser-peer-only-pnpm
- migration-upgrade-browser-source-only-pnpm
- migration-upgrade-browser-webdriverio-pnpm
- migration-upgrade-bun-catalog
- migration-upgrade-deprecated-coverage-c8-npm
- migration-upgrade-hooks-flag-pnpm
- migration-upgrade-monorepo-vitest-localized-pnpm
- packages/app
- migration-upgrade-nested-vitest-override-npm
- migration-upgrade-nuxt-test-utils-monorepo
- .fixture/nuxt-test-utils
- packages
- nuxt
- unit
- migration-upgrade-nuxt-test-utils
- .fixture/nuxt-test-utils
- migration-upgrade-peer-vitest-catalog-pnpm
- migration-upgrade-pkg-pr-new-npm
- migration-upgrade-pkg-pr-new-pnpm
- migration-upgrade-pnpm-bundled-catalog-dep
- migration-upgrade-pnpm-catalogs-default
- migration-upgrade-pnpm-named-catalog
- migration-upgrade-pnpm9-overrides
- migration-upgrade-required-vitest-peer-metadata-npm
- .fixture/vite-plugin-gherkin
- migration-upgrade-setup-full-pnpm
- migration-upgrade-setup-skipped-default-pnpm
- migration-upgrade-stale-local-pnpm
- local-vite-plus
- dist
- migration-upgrade-version-table-pnpm
- migration-upgrade-vite-plus-protocol-pin-npm
- migration-upgrade-vitest-exact-peer-npm
- migration-upgrade-vitest-exact-peer-yarn4
- migration-upgrade-vitest-non-runtime-only-npm
- migration-upgrade-vitest-reference-whitespace-pnpm
- migration-upgrade-vitest-retained-references-npm
- config
- migration-vite-version
- migration-vitest-import-only
- migration-vitest-peer-dep
- migration-vitest-unmanaged-override
- migration-volta-with-nvmrc
- migration-volta
- new-vite-monorepo-bun
- new-vite-monorepo
- snap-tests
- create-approve-builds-bun
- create-approve-builds-migrate-pnpm11
- create-approve-builds-pnpm11
- create-approve-builds-yarn
- create-org-bundled-monorepo
- lint-vite-plus-imports-nuxt
- src
- lint-vite-plus-imports
- migration-config-process-crash-isolated
- migration-inline-config-shorthand
- migration-preserve-editor-jsonc-comments
- migration-standalone-bun-install
- migration-vite-plus-in-dependencies-pnpm
- src
- __tests__
- fixtures/nuxt-test-utils
- migration
- __tests__
- __snapshots__
- compat
- migrator
- utils
- __tests__
- prompts/src
- tools/src
- rfcs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
0 commit comments