Skip to content
Open
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
11 changes: 8 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ All user-facing output must go through shared output modules instead of raw prin

## Build

- Run `pnpm bootstrap-cli` from the project root to build all packages and install the global CLI
- Run `pnpm build:cli` from the project root for normal local development
- This builds all `@voidzero-dev/*` and `vite-plus` packages
- Compiles the Rust NAPI bindings and the `vp` Rust binary
- Installs the CLI globally to `~/.vite-plus/`
- Compiles the Rust `vp` and `vite_trampoline` binaries in `debug`
- Uses only repo-local artifacts (`packages/cli/dist`, `packages/test/dist`, `target/debug/vp`)
- Assumes the local `rolldown/` and `vite/` checkouts already exist; use `just init` or `node packages/tools/src/index.ts sync-remote` to prepare them
- Run `pnpm bootstrap-cli` only when you need to validate the global install flow
- This performs the release build and installs the CLI globally to `~/.vite-plus/`

## Snap Tests

Expand All @@ -135,4 +138,6 @@ pnpm -F vite-plus snap-test-global
pnpm -F vite-plus snap-test-global <name-filter>
```

Global CLI snap tests use the repo-local debug binary and do not require `~/.vite-plus/bin`.

The snap test will automatically generate/update the `snap.txt` file with the command outputs. It exits with zero status even if there are output differences; you need to manually check the diffs(`git diff`) to verify correctness.
31 changes: 25 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install cargo-binstall
```

Initial setup to install dependencies for Vite+:
Initial setup to prepare the repo for local development:

```
just init
pnpm install:dev
```

### Windows
Expand All @@ -37,10 +37,10 @@ Install Rust & Cargo from [rustup.rs](https://rustup.rs/), then install `cargo-b
cargo install cargo-binstall
```

Initial setup to install dependencies for Vite+:
Initial setup to prepare the repo for local development:

```powershell
just init
pnpm install:dev
```

**Note:** Run commands in PowerShell or Windows Terminal. Some commands may require elevated permissions.
Expand All @@ -53,21 +53,38 @@ To create a release build of Vite+ and all upstream dependencies, run:
just build
```

## Local CLI workflow

```
pnpm bootstrap:dev
pnpm test
```

This prepares the local `rolldown/` and `vite/` checkouts, installs dependencies, builds the repo-local CLI artifacts, and runs tests without reading `~/.vite-plus`.

If you only want to prepare the repo after cloning it, run:

```
pnpm install:dev
```

If you prefer the existing Just-based setup, `just init` now delegates to the same repo-local install flow.

## Install the Vite+ Global CLI from source code

```
pnpm bootstrap-cli
vp --version
```

This builds all packages, compiles the Rust `vp` binary, and installs the CLI to `~/.vite-plus`.
Use this only when you specifically want to validate the install flow or the globally installed CLI.

## Workflow for build and test

You can run this command to build, test and check if there are any snapshot changes:

```
pnpm bootstrap-cli && pnpm test && git status
pnpm build:cli && pnpm test && git status
```

## Running Snap Tests
Expand All @@ -87,6 +104,8 @@ pnpm -F vite-plus snap-test-global
pnpm -F vite-plus snap-test-global <name-filter>
```

Global CLI snap tests use the repo-local debug binary and `packages/cli/dist`; they do not require `~/.vite-plus/bin`.

Snap tests auto-generate `snap.txt` files. Check `git diff` to verify output changes are correct.

## Verified Commits
Expand Down
3 changes: 1 addition & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ _clean_dist:

init: _clean_dist
cargo binstall watchexec-cli cargo-insta typos-cli cargo-shear dprint taplo-cli -y
node packages/tools/src/index.ts sync-remote
pnpm install
pnpm install:dev
pnpm -C docs install

build:
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
"type": "module",
"scripts": {
"build": "pnpm -F @voidzero-dev/* -F vite-plus build",
"bootstrap-cli": "pnpm build && cargo build -p vite_global_cli -p vite_trampoline --release && pnpm install-global-cli",
"install:dev": "node scripts/setup-local-dev.mjs",
"bootstrap:dev": "pnpm install:dev && pnpm build:cli",
"build:cli": "tool build-local-cli",
"bootstrap-cli": "pnpm install:dev && tool build-local-cli --release-rust && pnpm install-global-cli",
"bootstrap-cli:ci": "pnpm install-global-cli",
"install-global-cli": "tool install-global-cli",
"tsgo": "tsgo -b tsconfig.json",
"lint": "vp lint --type-aware --type-check --threads 4",
"test": "vp test run && pnpm -r snap-test",
"test": "pnpm build:cli && pnpm -F vite-plus test && pnpm -F vite-plus snap-test",
"fmt": "vp fmt",
"test:unit": "vp test run",
"test:unit": "pnpm build:cli && pnpm -F vite-plus test",
"docs:dev": "pnpm -C docs dev",
"docs:build": "pnpm -C docs build",
"prepare": "husky"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@
"build-native": "oxnode -C dev ./build.ts --skip-ts",
"snap-test": "pnpm snap-test-local && pnpm snap-test-global",
"snap-test-local": "tool snap-test",
"snap-test-global": "tool snap-test --dir snap-tests-global --bin-dir ~/.vite-plus/bin",
"snap-test-global": "tool snap-test-global-local",
"publish-native": "node ./publish-native-addons.ts",
"test": "vitest run"
"test": "tool local-cli test run"
},
"dependencies": {
"@oxc-project/types": "catalog:",
Expand Down
1 change: 1 addition & 0 deletions packages/prompts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"fast-string-width": "^1.1.0",
"fast-wrap-ansi": "^0.1.3",
"is-unicode-supported": "^1.3.0",
"rolldown": "workspace:*",
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added rolldown as a devDependency here, but there are no references to rolldown anywhere under packages/prompts/src (and the build config doesn’t reference it either). If this isn’t needed for builds/tests, it’s extra dependency surface and forces a lockfile entry/update. Either remove it or add a short note (e.g., in a comment or PR description) explaining why prompts needs rolldown in devDependencies.

Suggested change
"rolldown": "workspace:*",

Copilot uses AI. Check for mistakes.
"tsdown": "catalog:"
}
}
14 changes: 13 additions & 1 deletion packages/tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,26 @@ switch (subcommand) {
const { installGlobalCli } = await import('./install-global-cli.ts');
installGlobalCli();
break;
case 'build-local-cli':
const { runBuildLocalCli } = await import('./local-cli.ts');
runBuildLocalCli(process.argv.slice(3));
break;
case 'local-cli':
const { runLocalCli } = await import('./local-cli.ts');
runLocalCli(process.argv.slice(3));
break;
case 'snap-test-global-local':
const { runLocalGlobalSnapTest } = await import('./local-cli.ts');
runLocalGlobalSnapTest(process.argv.slice(3));
break;
case 'brand-vite':
const { brandVite } = await import('./brand-vite.ts');
brandVite();
break;
default:
console.error(`Unknown subcommand: ${subcommand}`);
console.error(
'Available subcommands: snap-test, replace-file-content, sync-remote, json-sort, merge-peer-deps, install-global-cli, brand-vite',
'Available subcommands: snap-test, replace-file-content, sync-remote, json-sort, merge-peer-deps, install-global-cli, build-local-cli, local-cli, snap-test-global-local, brand-vite',
);
process.exit(1);
}
Expand Down
Loading
Loading