Skip to content

Commit 7db2260

Browse files
committed
fix(workspace): support Bun object-form workspaces in package.json (#1250)
Bun and Yarn classic support `workspaces` as an object with a `packages` field (e.g., for Bun catalogs), not just an array. Handle both forms in workspace detection, create, and migrate flows. Closes #1247
1 parent 9322199 commit 7db2260

File tree

17 files changed

+432
-48
lines changed

17 files changed

+432
-48
lines changed

Cargo.lock

Lines changed: 33 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ dunce = "1.0.5"
8585
fast-glob = "1.0.0"
8686
flate2 = { version = "=1.1.9", features = ["zlib-rs"] }
8787
form_urlencoded = "1.2.1"
88-
fspy = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "1ef4e2f6bd783472ffdaa1cae874d142e2f56322" }
88+
fspy = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "eb746ad3f35bd994ddb39be001eaf58986f48388" }
8989
futures = "0.3.31"
9090
futures-util = "0.3.31"
9191
glob = "0.3.2"
@@ -186,15 +186,15 @@ vfs = "0.13.0"
186186
vite_command = { path = "crates/vite_command" }
187187
vite_error = { path = "crates/vite_error" }
188188
vite_js_runtime = { path = "crates/vite_js_runtime" }
189-
vite_glob = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "1ef4e2f6bd783472ffdaa1cae874d142e2f56322" }
189+
vite_glob = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "eb746ad3f35bd994ddb39be001eaf58986f48388" }
190190
vite_install = { path = "crates/vite_install" }
191191
vite_migration = { path = "crates/vite_migration" }
192192
vite_shared = { path = "crates/vite_shared" }
193193
vite_static_config = { path = "crates/vite_static_config" }
194-
vite_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "1ef4e2f6bd783472ffdaa1cae874d142e2f56322" }
195-
vite_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "1ef4e2f6bd783472ffdaa1cae874d142e2f56322" }
196-
vite_task = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "1ef4e2f6bd783472ffdaa1cae874d142e2f56322" }
197-
vite_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "1ef4e2f6bd783472ffdaa1cae874d142e2f56322" }
194+
vite_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "eb746ad3f35bd994ddb39be001eaf58986f48388" }
195+
vite_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "eb746ad3f35bd994ddb39be001eaf58986f48388" }
196+
vite_task = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "eb746ad3f35bd994ddb39be001eaf58986f48388" }
197+
vite_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "eb746ad3f35bd994ddb39be001eaf58986f48388" }
198198
walkdir = "2.5.0"
199199
wax = "0.6.0"
200200
which = "8.0.0"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "website",
3+
"version": "0.0.0"
4+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "test-bun-monorepo",
3+
"version": "0.0.0",
4+
"private": true,
5+
"workspaces": {
6+
"packages": [
7+
"apps/*",
8+
"packages/*",
9+
"tools/*"
10+
],
11+
"catalog": {
12+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
13+
"vitest": "npm:@voidzero-dev/vite-plus-test@latest",
14+
"vite-plus": "latest"
15+
}
16+
},
17+
"packageManager": "bun@1.3.11"
18+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "helper",
3+
"version": "0.0.0"
4+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
> cd apps/website && vp create --no-interactive vite:generator # from workspace subdir with object-form workspaces
2+
> test -f tools/vite-plus-generator/package.json && echo 'Created at tools/vite-plus-generator' || echo 'NOT at tools/'
3+
Created at tools/vite-plus-generator
4+
5+
> test ! -f apps/website/tools/vite-plus-generator/package.json && echo 'Not in apps/website/' || echo 'BUG: in apps/website/'
6+
Not in apps/website/
7+
8+
> cd apps && vp create --no-interactive vite:application # from workspace parent dir
9+
> test -f apps/vite-plus-application/package.json && echo 'Created at apps/vite-plus-application' || echo 'NOT at apps/'
10+
Created at apps/vite-plus-application
11+
12+
> cd scripts/helper && vp create --no-interactive vite:library # from non-workspace dir
13+
> test -f packages/vite-plus-library/package.json && echo 'Created at packages/vite-plus-library' || echo 'NOT at packages/'
14+
Created at packages/vite-plus-library
15+
16+
> cat package.json # verify workspaces object form preserved after workspace update
17+
{
18+
"name": "test-bun-monorepo",
19+
"version": "0.0.0",
20+
"private": true,
21+
"workspaces": {
22+
"packages": [
23+
"apps/*",
24+
"packages/*",
25+
"tools/*"
26+
],
27+
"catalog": {
28+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
29+
"vitest": "npm:@voidzero-dev/vite-plus-test@latest",
30+
"vite-plus": "latest"
31+
}
32+
},
33+
"packageManager": "bun@<semver>"
34+
}

0 commit comments

Comments
 (0)