Skip to content

fix(migrate): keep oxfmt scripts when a package declares oxfmt at runtime - #3607

Draft
liangmiQwQ wants to merge 3 commits into
voidzero-dev:mainfrom
liangmiQwQ:migrate-keep-runtime-oxfmt-scripts
Draft

liangmiQwQ wants to merge 3 commits into
voidzero-dev:mainfrom
liangmiQwQ:migrate-keep-runtime-oxfmt-scripts

Conversation

@liangmiQwQ

@liangmiQwQ liangmiQwQ commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

vp migrate rewrote oxfmt scripts to vp fmt unconditionally, but only added vite-plus when the replaced tool was a devDependency. A package that lists oxfmt in dependencies, optionalDependencies, or peerDependencies therefore kept the declaration and lost a runnable format script when used outside a workspace that already provides vp.

Migration now leaves oxfmt scripts in place when the package declares oxfmt at runtime. Packages that list oxfmt only as a devDependency still migrate to vp fmt and receive vite-plus.

🤖 Generated with Grok Bot

@forkstack-service

Copy link
Copy Markdown

…cies

The current `vp migrate` removes Oxlint, Oxfmt, tsdown, `@vitest/browser`, and `@vitest/browser-preview` from every dependency field. A tsdown plugin that lists `tsdown` in both `devDependencies` and `peerDependencies` loses both declarations, so the published package drops its `tsdown` peer and its own tests no longer run against a real tsdown.

This PR replaces these packages only when they are devDependencies. A package that also lists one in `dependencies`, `optionalDependencies`, or `peerDependencies` keeps every declaration of it, including the development copy. Such a package publishes or runs the tool, and its consumers may not use Vite+. Migration also keeps the catalog entry of such a package, so a kept `catalog:` reference still resolves. Its imports also stay unchanged instead of moving to the Vite+ surfaces.

This PR includes a shared `declaresRuntimeDependency` check in `migrator/shared.ts`. It replaces the Oxlint-only exception in both the fresh and existing Vite+ paths, and the tsx, oxnode, and ts-node runner check, which already followed this rule. Optional `oxlint` now counts as a runtime declaration too.
The current `vp migrate` removes ESLint and its plugins from every dependency field, and Prettier, `prettier-plugin-*`, lint-staged, and tsup from both `devDependencies` and `dependencies`. An ESLint plugin package loses its `eslint` peer and the `eslint` devDependency its rule tests import, and a package that runs Prettier from `dependencies` loses it.

This PR applies the rule from the bundled packages to these tools. Migration removes only their `devDependencies` entries. A package that also lists one in `dependencies`, `optionalDependencies`, or `peerDependencies` keeps every declaration of it.

For tsup, the check runs before `tsdown-migrate`, because that tool rewrites every tsup declaration in the package it runs in. A package that declares `tsup` at runtime keeps its tsup declarations, config, and scripts, and `tsdown-migrate` does not run there.

This PR includes a shared `removeReplacedDevDependency` helper in `migrator/shared.ts`, which replaces the separate field loops in the ESLint, Prettier, lint-staged, and tsup migrators.
…time

`vp migrate` rewrote `oxfmt` scripts to `vp fmt` unconditionally, but only added `vite-plus` when the replaced tool was a devDependency. A package that lists oxfmt in `dependencies`, `optionalDependencies`, or `peerDependencies` therefore kept the declaration and lost a runnable format script when used outside a workspace that already provides `vp`.

Migration now leaves `oxfmt` scripts in place when the package declares oxfmt at runtime. Packages that list oxfmt only as a devDependency still migrate to `vp fmt` and receive `vite-plus`.
@liangmiQwQ
liangmiQwQ force-pushed the migrate-keep-runtime-oxfmt-scripts branch from dca453f to 6bdcaba Compare November 29, 2026 22:08

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants