Skip to content

Commit 1448ffb

Browse files
committed
feat(dev): reapply clean bootstrap workflow
1 parent f1f6016 commit 1448ffb

File tree

9 files changed

+828
-18
lines changed

9 files changed

+828
-18
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
1717
cargo install cargo-binstall
1818
```
1919

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

2222
```
23-
just init
23+
pnpm install:dev
2424
```
2525

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

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

4242
```powershell
43-
just init
43+
pnpm install:dev
4444
```
4545

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

56+
## Local CLI workflow
57+
58+
```
59+
pnpm bootstrap:dev
60+
pnpm test
61+
```
62+
63+
This prepares the local `rolldown/` and `vite/` checkouts, installs dependencies, builds the repo-local CLI artifacts, and runs tests without reading `~/.vite-plus`.
64+
65+
If you only want to prepare the repo after cloning it, run:
66+
67+
```
68+
pnpm install:dev
69+
```
70+
71+
If you prefer the existing Just-based setup, `just init` now delegates to the same repo-local install flow.
72+
5673
## Install the Vite+ Global CLI from source code
5774

5875
```
5976
pnpm bootstrap-cli
6077
vp --version
6178
```
6279

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

6582
## Workflow for build and test
6683

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

6986
```
70-
pnpm bootstrap-cli && pnpm test && git status
87+
pnpm build:cli && pnpm test && git status
7188
```
7289

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

107+
Global CLI snap tests use the repo-local debug binary and `packages/cli/dist`; they do not require `~/.vite-plus/bin`.
108+
90109
Snap tests auto-generate `snap.txt` files. Check `git diff` to verify output changes are correct.
91110

92111
## Verified Commits

justfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ _clean_dist:
1818

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

2524
build:

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
"type": "module",
66
"scripts": {
77
"build": "pnpm -F @voidzero-dev/* -F vite-plus build",
8-
"bootstrap-cli": "pnpm build && cargo build -p vite_global_cli -p vite_trampoline --release && pnpm install-global-cli",
8+
"install:dev": "node scripts/setup-local-dev.mjs",
9+
"bootstrap:dev": "pnpm install:dev && pnpm build:cli",
10+
"build:cli": "tool build-local-cli",
11+
"bootstrap-cli": "pnpm install:dev && tool build-local-cli --release-rust && pnpm install-global-cli",
912
"bootstrap-cli:ci": "pnpm install-global-cli",
1013
"install-global-cli": "tool install-global-cli",
1114
"tsgo": "tsgo -b tsconfig.json",
1215
"lint": "vp lint --type-aware --type-check --threads 4",
13-
"test": "vp test run && pnpm -r snap-test",
16+
"test": "pnpm build:cli && pnpm -F vite-plus test && pnpm -F vite-plus snap-test",
1417
"fmt": "vp fmt",
15-
"test:unit": "vp test run",
18+
"test:unit": "pnpm build:cli && pnpm -F vite-plus test",
1619
"docs:dev": "pnpm -C docs dev",
1720
"docs:build": "pnpm -C docs build",
1821
"prepare": "husky"

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@
323323
"build-native": "oxnode -C dev ./build.ts --skip-ts",
324324
"snap-test": "pnpm snap-test-local && pnpm snap-test-global",
325325
"snap-test-local": "tool snap-test",
326-
"snap-test-global": "tool snap-test --dir snap-tests-global --bin-dir ~/.vite-plus/bin",
326+
"snap-test-global": "tool snap-test-global-local",
327327
"publish-native": "node ./publish-native-addons.ts",
328-
"test": "vitest run"
328+
"test": "tool local-cli test run"
329329
},
330330
"dependencies": {
331331
"@oxc-project/types": "catalog:",

packages/tools/src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,26 @@ switch (subcommand) {
2525
const { installGlobalCli } = await import('./install-global-cli.ts');
2626
installGlobalCli();
2727
break;
28+
case 'build-local-cli':
29+
const { runBuildLocalCli } = await import('./local-cli.ts');
30+
runBuildLocalCli(process.argv.slice(3));
31+
break;
32+
case 'local-cli':
33+
const { runLocalCli } = await import('./local-cli.ts');
34+
runLocalCli(process.argv.slice(3));
35+
break;
36+
case 'snap-test-global-local':
37+
const { runLocalGlobalSnapTest } = await import('./local-cli.ts');
38+
runLocalGlobalSnapTest(process.argv.slice(3));
39+
break;
2840
case 'brand-vite':
2941
const { brandVite } = await import('./brand-vite.ts');
3042
brandVite();
3143
break;
3244
default:
3345
console.error(`Unknown subcommand: ${subcommand}`);
3446
console.error(
35-
'Available subcommands: snap-test, replace-file-content, sync-remote, json-sort, merge-peer-deps, install-global-cli, brand-vite',
47+
'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',
3648
);
3749
process.exit(1);
3850
}

0 commit comments

Comments
 (0)