Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "migration-oxlint-existing-vite-plus",
"private": true,
"type": "module",
"packageManager": "npm@11.11.1",
"workspaces": ["packages/*"],
"devDependencies": {
"@oxlint/plugins": "1.79.0",
"vite-plus": "^0.1.20"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "app",
"private": true,
"type": "module",
"devDependencies": {
"@oxlint/plugins": "1.79.0",
"vite-plus": "^0.1.20"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { definePlugin, defineRule } from '@oxlint/plugins';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import { definePlugin, defineRule, type Context, type ESTree } from '@oxlint/plugins';
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[case]]
name = "migration_oxlint_existing_vite_plus"
vp = "global"
local-registry = true
unset-env = ["VP_SKIP_INSTALL"]
steps = [
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], snapshot = false },
{ argv = ["vpt", "print-file", "package.json", "packages/app/package.json"], comment = "Migration removes unused plugin API dependencies from the root and workspace package." },
{ argv = ["vpt", "print-file", "plugin.ts", "packages/app/plugin.ts"], comment = "Imports and exports use the bundled plugin API." },
{ argv = ["vpt", "json-edit", "package.json", "devDependencies.@oxlint/plugins", "1.79.0"], snapshot = false },
{ argv = ["vp", "install", "--ignore-scripts"], snapshot = false },
{ argv = ["node", "--input-type=module", "-e", "import fs from 'node:fs'; import assert from 'node:assert/strict'; const lock = JSON.parse(fs.readFileSync('package-lock.json', 'utf8')); assert.equal(lock.packages[''].devDependencies['@oxlint/plugins'], '1.79.0');"], snapshot = false },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "An already migrated project still cleans up a leftover dependency and updates its lockfile." },
{ argv = ["node", "--input-type=module", "-e", "import fs from 'node:fs'; import assert from 'node:assert/strict'; for (const file of ['package.json', 'packages/app/package.json']) { const pkg = JSON.parse(fs.readFileSync(file, 'utf8')); assert.equal(pkg.devDependencies['@oxlint/plugins'], undefined); } const lock = JSON.parse(fs.readFileSync('package-lock.json', 'utf8')); for (const name of ['', 'packages/app']) { assert.equal(lock.packages[name].devDependencies['@oxlint/plugins'], undefined); } console.log('No direct @oxlint/plugins dependencies remain in manifests or lockfile.');"], comment = "The cleanup must run an install even when it changes no imports or toolchain versions." },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], comment = "A further migration leaves the project unchanged." },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# migration_oxlint_existing_vite_plus

## `vp migrate --no-interactive --no-hooks --no-agent --no-editor`


## `vpt print-file package.json packages/app/package.json`

Migration removes unused plugin API dependencies from the root and workspace package.

```
{
"name": "migration-oxlint-existing-vite-plus",
"private": true,
"workspaces": [
"packages/*"
],
"type": "module",
"devDependencies": {
"vite-plus": "<version>"
},
"overrides": {
"vite": "npm:@voidzero-dev/vite-plus-core@<version>"
},
"packageManager": "npm@11.11.1"
}
{
"name": "app",
"private": true,
"type": "module",
"devDependencies": {
"vite-plus": "<version>"
}
}
```

## `vpt print-file plugin.ts packages/app/plugin.ts`

Imports and exports use the bundled plugin API.

```
import { definePlugin, defineRule, type Context, type ESTree } from "vite-plus/lint/plugins";
export { definePlugin, defineRule } from "vite-plus/lint/plugins";
```

## `vpt json-edit package.json devDependencies.@oxlint/plugins 1.79.0`


## `vp install --ignore-scripts`


## `node --input-type=module -e 'import fs from '\''node:fs'\''; import assert from '\''node:assert/strict'\''; const lock = JSON.parse(fs.readFileSync('\''package-lock.json'\'', '\''utf8'\'')); assert.equal(lock.packages['\'''\''].devDependencies['\''@oxlint/plugins'\''], '\''1.79.0'\'');'`


## `vp migrate --no-interactive --no-hooks --no-agent --no-editor`

An already migrated project still cleans up a leftover dependency and updates its lockfile.

```
VITE+ - The Unified Toolchain for the Web

Formatting code...

Code formatted
◇ Updated . to Vite+ <version>
• Node <version> npm <version>
✓ Dependencies installed in <duration>
```

## `node --input-type=module -e 'import fs from '\''node:fs'\''; import assert from '\''node:assert/strict'\''; for (const file of ['\''package.json'\'', '\''packages/app/package.json'\'']) { const pkg = JSON.parse(fs.readFileSync(file, '\''utf8'\'')); assert.equal(pkg.devDependencies['\''@oxlint/plugins'\''], undefined); } const lock = JSON.parse(fs.readFileSync('\''package-lock.json'\'', '\''utf8'\'')); for (const name of ['\'''\'', '\''packages/app'\'']) { assert.equal(lock.packages[name].devDependencies['\''@oxlint/plugins'\''], undefined); } console.log('\''No direct @oxlint/plugins dependencies remain in manifests or lockfile.'\'');'`

The cleanup must run an install even when it changes no imports or toolchain versions.

```
No direct @oxlint/plugins dependencies remain in manifests or lockfile.
```

## `vp migrate --no-interactive --no-hooks --no-agent --no-editor`

A further migration leaves the project unchanged.

```
VITE+ - The Unified Toolchain for the Web

This project is already using Vite+! Happy coding!
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "uninstalled-test-fixture",
"private": true,
"devDependencies": {
"uninstalled-plugin": "1.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
console.log(typeof require('@oxlint/plugins').defineRule);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "migration-oxlint-extensionless-script",
"private": true,
"packageManager": "pnpm@11.24.0",
"scripts": {
"check-plugin": "node bin/check-plugin"
},
"devDependencies": {
"@oxlint/plugins": "1.79.0",
"vite-plus": "latest"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
autoInstallPeers: false
hoist: false
minimumReleaseAge: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[case]]
name = "migration_oxlint_extensionless_script"
vp = "global"
local-registry = true
unset-env = ["VP_SKIP_INSTALL"]
steps = [
{ argv = ["vp", "install", "--ignore-scripts"], snapshot = false },
{ argv = ["vp", "run", "check-plugin"], comment = "The extensionless Node script works before migration." },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], snapshot = false },
{ argv = ["vpt", "print-file", "package.json", "bin/check-plugin"], comment = "Keep the dependency used by the unchanged extensionless script." },
{ argv = ["vpt", "rm", "-rf", "node_modules"], snapshot = false },
{ argv = ["vp", "install", "--ignore-scripts"], snapshot = false },
{ argv = ["vp", "run", "check-plugin"], comment = "The script still resolves the plugin API after a strict pnpm reinstall." },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# migration_oxlint_extensionless_script

## `vp install --ignore-scripts`


## `vp run check-plugin`

The extensionless Node script works before migration.

```
VITE+ - The Unified Toolchain for the Web

$ node bin/check-plugin ⊘ cache disabled
function
```

## `vp migrate --no-interactive --no-hooks --no-agent --no-editor`


## `vpt print-file package.json bin/check-plugin`

Keep the dependency used by the unchanged extensionless script.

```
{
"name": "migration-oxlint-extensionless-script",
"private": true,
"scripts": {
"check-plugin": "node bin/check-plugin"
},
"devDependencies": {
"@oxlint/plugins": "1.79.0",
"vite": "catalog:",
"vite-plus": "catalog:"
},
"packageManager": "pnpm@11.24.0"
}
#!/usr/bin/env node
console.log(typeof require('@oxlint/plugins').defineRule);
```

## `vpt rm -rf node_modules`


## `vp install --ignore-scripts`


## `vp run check-plugin`

The script still resolves the plugin API after a strict pnpm reinstall.

```
VITE+ - The Unified Toolchain for the Web

$ node bin/check-plugin ⊘ cache disabled
function
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
artifacts/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(typeof require('review-oxlint-plugin'));
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "migration-oxlint-required-peer",
"private": true,
"packageManager": "pnpm@11.24.0",
"scripts": {
"check-plugin": "node check.cjs"
},
"devDependencies": {
"@oxlint/plugins": "1.79.0",
"review-oxlint-plugin": "file:artifacts/review-oxlint-plugin-1.0.0.tgz",
"vite-plus": "latest"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@oxlint/plugins').defineRule;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "review-oxlint-plugin",
"version": "1.0.0",
"exports": "./index.cjs",
"packageManager": "pnpm@11.24.0",
"peerDependencies": {
"@oxlint/plugins": "^1.79.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
autoInstallPeers: false
hoist: false
minimumReleaseAge: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[case]]
name = "migration_oxlint_required_peer"
vp = "global"
local-registry = true
unset-env = ["VP_SKIP_INSTALL"]
steps = [
{ argv = ["vp", "pm", "pack", "--pack-destination", "../artifacts"], cwd = "plugin", snapshot = false },
{ argv = ["vpt", "rm", "-rf", "plugin"], comment = "Only the installed dependency contains a reference to the required peer.", snapshot = false },
{ argv = ["vp", "install", "--ignore-scripts"], snapshot = false },
{ argv = ["vp", "run", "check-plugin"], comment = "The installed plugin can load its required peer before migration." },
{ argv = ["node", "-e", "const { createRequire } = require('node:module'); console.log(typeof createRequire(require.resolve('vite-plus/package.json'))('@oxlint/plugins').defineRule);"], comment = "Vite+ also has its own transitive copy of the plugin API." },
{ argv = ["vp", "migrate", "--no-interactive", "--no-hooks", "--no-agent", "--no-editor"], snapshot = false },
{ argv = ["vpt", "print-file", "package.json"], comment = "Keep the direct provider even though application source never names the peer." },
{ argv = ["vpt", "rm", "-rf", "node_modules"], snapshot = false },
{ argv = ["vp", "install", "--ignore-scripts"], snapshot = false },
{ argv = ["vp", "run", "check-plugin"], comment = "The plugin still loads after reinstall with automatic peers and hoisting disabled." },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# migration_oxlint_required_peer

## `cd plugin && vp pm pack --pack-destination ../artifacts`


## `vpt rm -rf plugin`

Only the installed dependency contains a reference to the required peer.


## `vp install --ignore-scripts`


## `vp run check-plugin`

The installed plugin can load its required peer before migration.

```
VITE+ - The Unified Toolchain for the Web

$ node check.cjs ⊘ cache disabled
function
```

## `node -e 'const { createRequire } = require('\''node:module'\''); console.log(typeof createRequire(require.resolve('\''vite-plus/package.json'\''))('\''@oxlint/plugins'\'').defineRule);'`

Vite+ also has its own transitive copy of the plugin API.

```
function
```

## `vp migrate --no-interactive --no-hooks --no-agent --no-editor`


## `vpt print-file package.json`

Keep the direct provider even though application source never names the peer.

```
{
"name": "migration-oxlint-required-peer",
"private": true,
"scripts": {
"check-plugin": "node check.cjs"
},
"devDependencies": {
"@oxlint/plugins": "1.79.0",
"review-oxlint-plugin": "file:artifacts/review-oxlint-plugin-1.0.0.tgz",
"vite": "catalog:",
"vite-plus": "catalog:"
},
"packageManager": "pnpm@11.24.0"
}
```

## `vpt rm -rf node_modules`


## `vp install --ignore-scripts`


## `vp run check-plugin`

The plugin still loads after reinstall with automatic peers and hoisting disabled.

```
VITE+ - The Unified Toolchain for the Web

$ node check.cjs ⊘ cache disabled
function
```
4 changes: 4 additions & 0 deletions packages/cli/src/migration/__tests__/migrator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8793,6 +8793,7 @@ describe('existing Vite+ core migration finalization', () => {
});

expect(finalizeCoreMigrationForExistingVitePlus(workspaceInfo, true)).toEqual({
dependencies: false,
scripts: true,
tsconfigTypes: true,
imports: true,
Expand Down Expand Up @@ -8869,6 +8870,7 @@ export default defineConfig({

const workspaceInfo = makeWorkspaceInfo(tmpDir, PackageManager.pnpm);
expect(finalizeCoreMigrationForExistingVitePlus(workspaceInfo, true)).toEqual({
dependencies: false,
scripts: false,
tsconfigTypes: false,
imports: true,
Expand All @@ -8885,6 +8887,7 @@ export default defineConfig({
);

expect(finalizeCoreMigrationForExistingVitePlus(workspaceInfo, true)).toEqual({
dependencies: false,
scripts: false,
tsconfigTypes: false,
imports: false,
Expand Down Expand Up @@ -8921,6 +8924,7 @@ export default defineConfig({ entry: 'src/index.ts' });
);

expect(result).toEqual({
dependencies: false,
scripts: false,
tsconfigTypes: false,
imports: true,
Expand Down
Loading
Loading