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
9 changes: 9 additions & 0 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ jobs:
- name: Install dependencies
run: pnpm install

# The registry bridge rewrites dependencies by package name. Stamp core
# before pnpm pack so the dependency named `vite` already aliases the
# preview version. Keep the CLI manifest aligned with its built dist too.
- name: Set preview package versions
run: |
for package in cli core; do
pnpm exec json-edit "packages/$package/package.json" '_.version = process.env.VERSION'
done

- name: Download cli dist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const appRequire = createRequire(new URL('./packages/app/package.json', import.meta.url));
const cliRequire = createRequire(require.resolve('vite-plus/package.json'));
console.log('Root Vite:', require('vite/package.json').name);
console.log('App Vite:', appRequire('vite/package.json').name);
console.log('CLI Vite:', cliRequire('vite/package.json').name);
assert.equal(require('vite/package.json').name, 'vite');
assert.equal(appRequire('vite/package.json').name, '@voidzero-dev/vite-plus-core');
assert.equal(cliRequire('vite/package.json').name, '@voidzero-dev/vite-plus-core');
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "core-command-root",
"private": true,
"type": "module",
"packageManager": "pnpm@11.24.0",
"workspaces": [
"packages/*"
],
"devDependencies": {
"vite": "8.2.2",
"vite-plus": "latest"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Correct project root</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "app",
"private": true,
"type": "module",
"scripts": {
"build": "vp build",
"pack": "vp pack"
},
"devDependencies": {
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
"vite-plus": "latest"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const message = 'Correct project root';
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import assert from 'node:assert/strict';

export default {
server: { host: '127.0.0.1', port: 0 },
preview: { host: '127.0.0.1', port: 0 },
plugins: [
{
name: 'check-target-server',
configureServer: checkServer,
configurePreviewServer: checkServer,
},
],
};

function checkServer(server) {
server.httpServer.once('listening', async () => {
try {
const address = server.httpServer.address();
assert.ok(address && typeof address === 'object');
const response = await fetch(`http://127.0.0.1:${address.port}/`, {
signal: AbortSignal.timeout(10_000),
});
assert.equal(response.status, 200);
assert.match(await response.text(), /Correct project root/);
console.log('The target app served HTTP 200');
} catch (error) {
console.error(error);
process.exitCode = 1;
} finally {
// PreviewServer has no close() method.
if (server.close) {
await server.close();
} else {
server.httpServer.close();
}
}
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages:
- packages/*
minimumReleaseAge: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[case]]
name = "core_command_root_dispatch"
vp = ["local", "global"]
local-registry = true
comment = "The workspace declares upstream Vite. Only the target app declares the matching core alias. Check positional roots, -C, defaultPackage, and task dispatch."
steps = [
{ argv = ["vp", "install", "--ignore-scripts"], timeout = 120000, snapshot = false },
["node", "check-layout.mjs"],
["vp", "build", "packages/app"],
["vp", "build", "--mode", "production", "--emptyOutDir", "packages/app"],
["vp", "dev", "packages/app"],
["vp", "preview", "--strictPort", "packages/app"],
["vp", "-C", "packages/app", "build"],
["vp", "build"],
["vp", "pack"],
["vp", "run", "--filter", "app", "build"],
["vp", "run", "--filter", "app", "pack"],
{ argv = ["vp", "build", "."], continue-on-failure = true },
["vp", "-C", ".", "pack", "packages/app/src/index.ts"],
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# core_command_root_dispatch

The workspace declares upstream Vite. Only the target app declares the matching core alias. Check positional roots, -C, defaultPackage, and task dispatch.

## `vp install --ignore-scripts`


## `node check-layout.mjs`

```
Root Vite: vite
App Vite: @voidzero-dev/vite-plus-core
CLI Vite: @voidzero-dev/vite-plus-core
```

## `vp build packages/app`

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

✓ 2 modules transformed.
computing gzip size...
packages/app/dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp build --mode production --emptyOutDir packages/app`

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

✓ 2 modules transformed.
computing gzip size...
packages/app/dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp dev packages/app`

```

VITE+ <version>

➜ Local: http://127.0.0.1:<port>/
➜ press h + enter to show help
The target app served HTTP 200
```

## `vp preview --strictPort packages/app`

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

➜ Local: http://127.0.0.1:<port>/
➜ press h + enter to show help
The target app served HTTP 200
```

## `vp -C packages/app build`

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

note: You are running `vp build` as a Vite+ built-in command. If you meant to run the build npm script, use `vpr build` instead.
✓ 2 modules transformed.
computing gzip size...
dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp build`

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

note: vp build: using packages/app (defaultPackage in vite.config.ts)
✓ 2 modules transformed.
computing gzip size...
dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp pack`

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

note: vp pack: using packages/app (defaultPackage in vite.config.ts)
ℹ entry: src/index.ts
ℹ Build start
ℹ Cleaning <n> files
ℹ dist/index.mjs <size> kB │ gzip: <size> kB
ℹ 1 files, total: <size> kB
✔ Build complete in <duration>
```

## `vp run --filter app build`

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

~/packages/app$ vp build ⊘ cache disabled
✓ 2 modules transformed.
computing gzip size...
dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp run --filter app pack`

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

~/packages/app$ vp pack ⊘ cache disabled
ℹ entry: src/index.ts
ℹ Build start
ℹ Cleaning <n> files
ℹ dist/index.mjs <size> kB │ gzip: <size> kB
ℹ 1 files, total: <size> kB
✔ Build complete in <duration>
```

## `vp build .`

**Exit code:** 1

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

error: Failed to resolve vite command: GenericFailure, Expected @voidzero-dev/vite-plus-core@<version>, but found vite@8.2.2 at <workspace>/node_modules/.pnpm/vite@8.2.2/node_modules/vite/package.json. Run `vp migrate` to align the Vite alias, then run `vp install`.
```

## `vp -C . pack packages/app/src/index.ts`

**Exit code:** 1

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

error: Failed to resolve pack command: GenericFailure, Expected @voidzero-dev/vite-plus-core@<version>, but found vite@8.2.2 at <workspace>/node_modules/.pnpm/vite@8.2.2/node_modules/vite/package.json. Run `vp migrate` to align the Vite alias, then run `vp install`.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# core_command_root_dispatch

The workspace declares upstream Vite. Only the target app declares the matching core alias. Check positional roots, -C, defaultPackage, and task dispatch.

## `vp install --ignore-scripts`


## `node check-layout.mjs`

```
Root Vite: vite
App Vite: @voidzero-dev/vite-plus-core
CLI Vite: @voidzero-dev/vite-plus-core
```

## `vp build packages/app`

```
✓ 2 modules transformed.
computing gzip size...
packages/app/dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp build --mode production --emptyOutDir packages/app`

```
✓ 2 modules transformed.
computing gzip size...
packages/app/dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp dev packages/app`

```

VITE+ <version>

➜ Local: http://127.0.0.1:<port>/
➜ press h + enter to show help
The target app served HTTP 200
```

## `vp preview --strictPort packages/app`

```
➜ Local: http://127.0.0.1:<port>/
➜ press h + enter to show help
The target app served HTTP 200
```

## `vp -C packages/app build`

```
note: You are running `vp build` as a Vite+ built-in command. If you meant to run the build npm script, use `vpr build` instead.
✓ 2 modules transformed.
computing gzip size...
dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp build`

```
note: vp build: using packages/app (defaultPackage in vite.config.ts)
✓ 2 modules transformed.
computing gzip size...
dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp pack`

```
note: vp pack: using packages/app (defaultPackage in vite.config.ts)
ℹ entry: src/index.ts
ℹ Build start
ℹ Cleaning <n> files
ℹ dist/index.mjs <size> kB │ gzip: <size> kB
ℹ 1 files, total: <size> kB
✔ Build complete in <duration>
```

## `vp run --filter app build`

```
~/packages/app$ vp build ⊘ cache disabled
✓ 2 modules transformed.
computing gzip size...
dist/index.html <size> kB │ gzip: <size> kB

✓ built in <duration>
```

## `vp run --filter app pack`

```
~/packages/app$ vp pack ⊘ cache disabled
ℹ entry: src/index.ts
ℹ Build start
ℹ Cleaning <n> files
ℹ dist/index.mjs <size> kB │ gzip: <size> kB
ℹ 1 files, total: <size> kB
✔ Build complete in <duration>
```

## `vp build .`

**Exit code:** 1

```
error: Failed to resolve vite command: GenericFailure, Expected @voidzero-dev/vite-plus-core@<version>, but found vite@8.2.2 at <workspace>/node_modules/.pnpm/vite@8.2.2/node_modules/vite/package.json. Run `vp migrate` to align the Vite alias, then run `vp install`.
```

## `vp -C . pack packages/app/src/index.ts`

**Exit code:** 1

```
error: Failed to resolve pack command: GenericFailure, Expected @voidzero-dev/vite-plus-core@<version>, but found vite@8.2.2 at <workspace>/node_modules/.pnpm/vite@8.2.2/node_modules/vite/package.json. Run `vp migrate` to align the Vite alias, then run `vp install`.
```
Loading
Loading