Repository navigation
Description
Describe the bug
When running create-void (or vp create void) targeting a subdirectory within an existing pnpm monorepo (e.g., apps/website), pnpm-workspace.yaml and pnpm-lock.yaml are generated directly under the target directory.
This creates an unwanted nested workspace within the monorepo, breaking consistency with the root pnpm-workspace.yaml, catalog settings, and the root lock file.
Steps to Reproduce
-
Create and navigate into a pnpm monorepo environment (with a
pnpm-workspace.yamlat the root):vp create vite:monorepo my-monorepo --no-interactive --package-manager pnpm cd my-monorepo -
Run
create-voidtargeting a subdirectory within the monorepo (e.g.,apps/website):# Example 1: Via vp vp create void apps/website -- --toolchain vite-plus --framework vue --starter sqlite --deploy none # Example 2: Running pnpm create void directly pnpm create void apps/website -- --toolchain vite-plus --framework vue --starter sqlite --deploy none
-
Check the contents of the generated subdirectory (
apps/website):ls -la apps/website/pnpm-workspace.yaml apps/website/pnpm-lock.yaml
Expected Behavior
- If a
pnpm-workspace.yamlalready exists in a parent or ancestor directory (i.e., in a monorepo environment):- Do not create a new
pnpm-workspace.yamldirectly under the target directory. - If necessary, merge required settings (
esbuild,sharp,workerd, etc.) into theallowBuildsfield of the rootpnpm-workspace.yaml, or prompt the user to approve them at the root level (pnpm approve-builds). - Do not run
pnpm installspecifically for the target directory to generate an individualpnpm-lock.yaml(delegate the full installation to the root-level package manager or wrapper tool, or allow it to be suppressed with a--no-installflag).
- Do not create a new
Actual Behavior
- Regardless of whether the parent directory is a monorepo,
apps/website/pnpm-workspace.yamlis created unconditionally. - Immediately afterward,
pnpm install --no-frozen-lockfileis executed with the target directory as the current working directory, causing pnpm to recognize the target directory itself as an independent workspace root and generatingapps/website/pnpm-lock.yaml. - As a result, an invalid nested workspace remains within the monorepo structure.
Root Cause Analysis
This is caused by the following processes running unconditionally in packages/create-void:
-
Forced writing via
writePnpmBuildPolicy:- Relevant code:
packages/create-void/src/pm.ts#L10-L20 - A new
pnpm-workspace.yamlis unconditionally created directly under the target directory without checking whether apnpm-workspace.yamlalready exists in any parent or ancestor directories of the target.
- Relevant code:
-
Executing installation directly under the target:
- Relevant code:
packages/create-void/src/main.ts#L62-L76 run(pmInstall(pm), targetDir)(pnpm install --no-frozen-lockfile) is executed withcwdset to the target directory wherepnpm-workspace.yamlwas just created. Consequently, pnpm treats it as an independent workspace root and generates a separatepnpm-lock.yamlinside the subdirectory.- Additionally,
create-voidlacks a--no-installoption for external tools or monorepos.
- Relevant code:
Proposed Solutions
-
Workspace detection in ancestor directories:
- Before executing
writePnpmBuildPolicy, traverse upward from the target directory through parent directories to check for an existingpnpm-workspace.yaml(workspace root). - If an existing monorepo root is found:
- Skip outputting
pnpm-workspace.yamlto the subdirectory. - Append/merge the configuration into the
allowBuildsfield of the rootpnpm-workspace.yaml, or prompt execution at the root level.
- Skip outputting
- Before executing
-
Adding a
--no-installoption:- Support a
--no-install(or--skip-install) flag to skip automatic dependency installation, similar to othercreate-*packages such as@tanstack/cliandsv.
- Support a
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
yuikisaito commentedon Nov 20, 2026
I'd be happy to submit a PR for this if the proposed approach looks good to you! Please let me know.
cpojer commentedon Nov 21, 2026
Yes, please send a PR!