fix(migrate): support guarded package installs#2185
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 734bffb2de
ℹ️ 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".
| '@vitest/web-worker', | ||
| '@vitest/ws-client', | ||
| ] as const; | ||
| const MANAGED_AGE_GATE_EXCLUDES = [...PREVIEW_TRUST_PACKAGES, ...MANAGED_VITEST_PACKAGES]; |
There was a problem hiding this comment.
Include direct CLI tool deps in age-gate excludes
With npm or Bun age gates, this combined list is the complete set of package-name exclusions written before vp install. It covers Vite+/native packages and Vitest, but omits direct toolchain dependencies that the published vite-plus package installs (oxfmt, oxlint, oxlint-tsgolint, @oxlint/plugins, @oxc-project/types; see packages/cli/package.json:361-377), while the existing pnpm age-gate code already treats the ox family as Vite+-managed (packages/cli/src/migration/migrator/catalog.ts:62-72). If one of those exact bundled versions is still younger than the user's npm/Bun release-age gate, migrate/create installs will still be rejected despite this reconciliation.
Useful? React with 👍 / 👎.
| const body = excludesMatch[2]; | ||
| const trailingWhitespace = body.match(/\s*$/)?.[0] ?? ''; | ||
| const content = body.slice(0, body.length - trailingWhitespace.length); | ||
| const separator = content.trim().length === 0 ? '' : content.trimEnd().endsWith(',') ? '' : ','; |
There was a problem hiding this comment.
Preserve commas before appending to commented TOML arrays
For Bun projects whose existing minimumReleaseAgeExcludes is a multiline array with an inline comment on the last item and no trailing comma, for example "@demo/*" # keep local, this computes a comma but appends it after the comment text. TOML treats that comma as part of the comment, so the next inserted package is not comma-separated and the rewritten bunfig.toml becomes invalid; insert the separator before any inline comment or parse the TOML instead of splicing the string.
Useful? React with 👍 / 👎.
Summary
Validation
pnpm -F vite-plus exec vitest run src/utils src/migration(552 tests)vp checkjust snapshot-test migration(133 passed concurrently; every stale-build or registry-timeout case passed when rerun in isolation)vp whyverification for Vite+ core, vite-plus, and Vitest in all four projects