Skip to content

fix(migrate): keep replaced tools that a package declares at runtime - #3594

Draft
liangmiQwQ wants to merge 8 commits into
voidzero-dev:mainfrom
liangmiQwQ:migrate-replaced-dev-only
Draft

liangmiQwQ wants to merge 8 commits into
voidzero-dev:mainfrom
liangmiQwQ:migrate-replaced-dev-only

Conversation

@liangmiQwQ

@liangmiQwQ liangmiQwQ commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

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.

🤖 Generated with Claude Code

…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+. A kept `catalog:` reference becomes the range it pointed at, because migration still removes the catalog entry.

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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@ghost
ghost force-pushed the migrate-replaced-dev-only branch from 625e292 to 58ecda5 Compare November 28, 2026 09:52
A bundled package that a package declares at runtime keeps its catalog entry, so a kept `catalog:` reference, including one written by Vitest alignment, still resolves.
@liangmiQwQ
liangmiQwQ force-pushed the migrate-replaced-dev-only branch from 58ecda5 to 148364c Compare November 28, 2026 14:18
…ndencies

A package that lists tsdown or oxlint in optionalDependencies now keeps
that declaration, so its imports must keep resolving to the tool instead
of moving to vite-plus/pack or vite-plus/lint/plugins.
@liangmiQwQ
liangmiQwQ force-pushed the migrate-replaced-dev-only branch from 0aa946d to 03fd389 Compare November 29, 2026 05:22
@forkstack-service

Copy link
Copy Markdown

liangmiQwQ and others added 4 commits November 29, 2026 22:45
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.

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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
…untime

`tsdown-migrate` rewrites every tsup declaration in the package it runs in. A tsup plugin that lists `tsup` in `peerDependencies` and `devDependencies` therefore lost both before Vite+ could decide to keep them, and its published peer became `"tsdown": "*"`.

Migration now runs `tsdown-migrate` only in packages where `tsup` is a devDependency alone. A package that also declares it in `dependencies`, `optionalDependencies`, or `peerDependencies` keeps its tsup declarations, config, and scripts unchanged, and does not trigger the tsup migration prompt on its own.
@liangmiQwQ
liangmiQwQ force-pushed the migrate-replaced-dev-only branch from 03fd389 to 5e34ff5 Compare November 29, 2026 14:46

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