fix: monorepo templates ignore the user's package manager#9962
Merged
shadcn merged 5 commits intoshadcn-ui:mainfrom Mar 13, 2026
Merged
Conversation
All monorepo templates hardcoded `packageManager: "pnpm"` which meant running `bunx --bun shadcn@latest init --monorepo` would still shell out to `pnpm install`, triggering Corepack and crashing under Bun because `process.mainModule` is readonly there. This removes the hardcoded pnpm override from every monorepo template config so `getPackageManager()` can actually detect what the user is running. The scaffold step now adapts the cloned template on the fly: - strips the `packageManager` field from package.json (avoids Corepack) - converts pnpm-workspace.yaml to a `"workspaces"` array in package.json - removes pnpm-lock.yaml - rewrites `workspace:*` refs to `"*"` when the detected PM is npm (npm doesn't support the workspace: protocol) - picks the right install flags per PM (`--no-frozen-lockfile` for pnpm, nothing extra for bun/npm/yarn) pnpm behavior is completely unchanged — `adaptWorkspaceConfig` early- returns when the detected PM is pnpm.
Contributor
|
@devinscodebase is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
|
I'll take a look. Thank you. |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Author
Great - let me know if you need anything :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7695
All monorepo templates hardcode
packageManager: "pnpm"which overridesgetPackageManager()entirely. Runningbunx --bun shadcn init --monorepostill shells out to
pnpm install, Corepack tries to kick in, and Buncrashes on
process.mainModule = void 0(readonly in Bun's runtime).Repro:
This removes the hardcoded overrides and lets detection work. Since the
templates on disk are pnpm-structured, the scaffold step now converts
them after cloning when a different PM is detected:
"packageManager"from package.json (stops Corepack)pnpm-workspace.yamlinto package.json"workspaces"pnpm-lock.yamlworkspace:*to"*"for npm (bun/yarn handle it natively)--no-frozen-lockfileonly for pnpm, nothing extra otherwiseWhen pnpm is detected nothing runs — early return, zero change in behavior.
Non-monorepo templates are also unaffected (conversion is gated on
pnpm-workspace.yamlexisting).All existing shadcn tests pass with zero changes needed to any other test
file (60/60 files, 1197/1197 tests). Updated scaffold.test.ts to cover
the new per-PM install arg behavior. Also tested end-to-end locally with
bun, pnpm, and npm monorepo init.