vp migrate rewrites catalog: specs in a Bun project whose workspaces.packages is empty
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 76/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- bun, typescript
- 領域
- build-system, cli
研究方向
從 packages/cli/src/migration/migrator/vite-plus-bootstrap.ts 中的 bunWorkspaceDeclaresPackages() 著手,檢查它如何處理根 workspaces 欄位的陣列和物件形式。使用 issue 中的 package.json 和 vp migrate 命令,透過 Bun 1.4.4 重現問題。當根 workspace 欄位包含空的 package 清單時,migration 保持 catalog 參照和 overrides 不變,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Describe the bug
In a single-package Bun project that keeps its toolchain in workspaces.catalog with an empty workspaces.packages array, vp migrate handles the project as if it had no catalog support. It replaces every catalog: reference in devDependencies, and the catalog-valued entries in overrides, with concrete versions. workspaces.catalog stays in package.json, but nothing references it anymore.
Bun resolves this setup: bun install succeeds and vite resolves to @voidzero-dev/vite-plus-core. Bun only needs the root package.json to have a workspaces field; without one it fails with catalogs require a "workspaces" field in the root package.json. "workspaces": [] and "workspaces": { "packages": [] } both work.
The check that rejects this setup is bunWorkspaceDeclaresPackages() in packages/cli/src/migration/migrator/vite-plus-bootstrap.ts, which requires a non-empty package list. The comment above it says Bun resolves catalog: references only inside a workspace whose root package.json declares a non-empty workspaces. Bun 1.4.4 does not behave that way.
Reproduction
package.json:
{
"name": "bun-root-catalog",
"private": true,
"type": "module",
"packageManager": "[email protected]",
"devDependencies": {
"@vitest/coverage-v8": "catalog:",
"vite": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
},
"workspaces": {
"packages": [],
"catalog": {
"@vitest/coverage-v8": "5.1.0",
"vite": "npm:@voidzero-dev/[email protected]",
"vite-plus": "1.5.0",
"vitest": "5.1.0"
}
},
"overrides": {
"vite": "catalog:",
"vitest": "catalog:"
}
}
printf 'node_modules\n' > .gitignore
bun install
git init && git add -A && git commit -m init
vp migrate --no-interactive --no-hooks --no-agent --no-editor
git diff package.json
Actual: bun install succeeds before the migration. Afterwards devDependencies become "@vitest/coverage-v8": "5.1.0", "vite": "npm:@voidzero-dev/[email protected]", "vite-plus": "1.5.0" and "vitest": "5.1.0", and overrides become "vite": "npm:@voidzero-dev/[email protected]" and "vitest": "5.1.0". The catalog is left unused.
Expected: no changes. With only "packages": [] changed to "packages": ["packages/*"], and no packages directory at all, the same command prints This project is already using Vite+! Happy coding! and leaves package.json as it is.
Suggested fix
For Bun, treat any root workspaces field (array or object form) as catalog support, which matches the check Bun itself applies, instead of requiring a non-empty package list.
Environment
- vite-plus 1.5.0 (global and local)
- Bun 1.4.4
- Node 26.13.0
- macOS arm64
Related, but different: #1247 (object-form workspaces, fixed in #1250) and #2309 (vp up rewriting catalog: specs in a monorepo). I have not checked Bun versions older than 1.4.4.
- 主要語言
- TypeScript
- 星號
- 6.6k
- 分支
- 303
- 平均合併
- 1 天 4 小時
- 30 天內合併 PR
- 224
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
voidzero-dev/vite-plus 的其他 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
voidzero-dev/vite-plus#3381 ·
維護者通常 1 天內回覆
-
`vp env pin`: says "Created .node-version" when overwriting an existing file可能已有人在做 @CheHyeonYeong 今天認領。 未關閉contribution welcome documentation
難度 2/5 1-3 小時 新手友好度 76/100
voidzero-dev/vite-plus#3370 · 3 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
triage: not actionable
難度 2/5 1-3 小時 新手友好度 85/100
voidzero-dev/vite-plus#3296 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
pending triage
難度 2/5 1-3 小時 新手友好度 63/100
voidzero-dev/vite-plus#3235 ·
維護者通常 1 天內回覆
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and later可能已有人在做 @kshanxs 於 14 天前認領。 未關閉documentation
難度 2/5 1-3 小時 新手友好度 84/100
voidzero-dev/vite-plus#3219 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 voidzero-dev/vite-plus 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 74/100
langchain-ai/langchainjs#12157 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
activescott/home-infra-k8s-flux#511 ·
維護者通常 1 天內回覆
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難度 1/5 1 小時以內 新手友好度 72/100
lingdojo/kana-dojo#33753 · 1 則留言 · 5 個 reaction ·
維護者通常 1 天內回覆
-
android:player
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
follow-up needs-triage S3: minor
難度 1/5 1-3 小時 新手友好度 85/100
manaflow-ai/cmux#38032 · 1 則留言 ·
維護者通常 1 天內回覆