Uh oh!
There was an error while loading. Please reload this page.
feat: add migration command for global cli - #313
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
b2efe90 to
ffb9f05Compare82e36fc to
6b0deacComparefcd5cbf to
88272abCompare2be81ff to
6fcd480Compare88272ab to
7b89d29Compare6fcd480 to
68fe850Compare7b89d29 to
349685cCompare349685c to
b6ca06eCompare61d1667 to
c237124Compareb6ca06e to
c109707Comparec237124 to
f9bd6bfComparec109707 to
9eae888Comparef9bd6bf to
952288eCompare9eae888 to
6d0c02eCompare952288e to
e5bbf69Compareda1d4d3 to
88f6cb5Comparee5bbf69 to
09993f5Compare1ba133d to
fea670aComparefea670a to
9b0b3d3CompareThere was a problem hiding this comment.
Pull request overview
This PR introduces a new vite migration command to automate the migration from standalone tools (vite, vitest, oxlint, oxfmt, tsdown) to the unified vite-plus toolchain. The implementation refactors the script rewriting system to be more flexible and adds support for migrating lint-staged configurations.
Key changes include:
- Refactored
rewritePackageJsonScripts→rewriteScriptswith a content-based API that accepts strings instead of file paths and returns updated content instead of writing directly - Added support for migrating lint-staged configurations in both package.json and standalone .lintstagedrc.json files
- Removed async tokio dependency from the vite_migration crate (now synchronous)
- Reorganized global package utilities into separate modules (json.ts, yaml.ts, package.ts, prompts.ts, command.ts)
- Added comprehensive RFC documentation for the migration command
Reviewed changes
Copilot reviewed 51 out of 54 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| rfcs/migration-command.md | New RFC documenting the migration command design, usage, and scope |
| crates/vite_migration/src/package.rs | Refactored script rewriting to be content-based instead of file-based; added support for array-based scripts |
| crates/vite_migration/Cargo.toml | Removed tokio dependency since migration is now synchronous |
| packages/cli/binding/src/migration.rs | Updated binding to use new rewriteScripts API |
| packages/cli/binding/index.js | Updated export from rewritePackageJsonScripts to rewriteScripts |
| packages/cli/binding/index.d.ts | Updated TypeScript definitions for the new API |
| packages/global/src/migration/migrator.ts | Core migration logic for standalone and monorepo projects |
| packages/global/src/migration/detector.ts | Configuration file detection logic |
| packages/global/src/migration/bin.ts | CLI entry point for the migration command |
| packages/global/src/utils/*.ts | Split utilities into separate modules (json, yaml, package, prompts, command, path, workspace) |
| packages/global/rules/vite-tools.yml | Removed tsdown migration rules (out of scope for this PR) |
| packages/global/templates/monorepo/* | Updated templates to remove vite-plus pre-configuration (applied during migration instead) |
| packages/global/snap-tests/migration-lintstagedrc/* | Integration test for lint-staged migration |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 57 changed files in this pull request and generated 3 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 58 out of 61 changed files in this pull request and generated 3 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 59 out of 62 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 59 out of 62 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 67 out of 70 changed files in this pull request and generated 5 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.

TL;DR
Refactored the package script migration system to be more flexible and support additional use cases like lint-staged configurations.
What changed?
rewritePackageJsonScriptstorewriteScriptswith a more flexible APInullwhen no changes are neededHow to test?
Test with a project that has lint-staged configuration:
Test with a standalone .lintstagedrc.json file:
Verify that:
Why make this change?
The previous implementation was limited to only migrating scripts in package.json and required file system access. This refactoring makes the script migration system more flexible and reusable across different contexts.
By supporting lint-staged configurations, we ensure that pre-commit hooks are properly migrated to use the unified vite-plus commands. This is particularly important for maintaining code quality workflows during migration.
The new design also follows better separation of concerns - the core migration logic doesn't need to know about file paths or perform I/O operations, making it easier to test and more composable.