fix(cli): allow apply in monorepo UI workspaces without framework config#10424
Open
yogeshwaran-c wants to merge 1 commit intoshadcn-ui:mainfrom
Open
fix(cli): allow apply in monorepo UI workspaces without framework config#10424yogeshwaran-c wants to merge 1 commit intoshadcn-ui:mainfrom
yogeshwaran-c wants to merge 1 commit intoshadcn-ui:mainfrom
Conversation
Fixes shadcn-ui#10411 When running `shadcn apply -c packages/ui` on a shadcn-generated monorepo, the preflight failed with "could not detect a supported framework" because `packages/ui` intentionally has no framework config (next/vite/etc.). It only contains the UI library. Trust the existing `components.json` and skip the framework detection error in `preFlightInit` when `options.existingConfig` is provided. This also benefits any re-init flow on a project that has already been configured.
Contributor
|
@yogeshwaran-c is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
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.
What kind of change does this PR introduce?
Bug fix.
What is the current behavior?
Closes #10411
Running
shadcn apply -c packages/ui(orbunx shadcn@latest apply --preset … -c packages/ui) from a shadcn-generated monorepo fails with:The target
packages/uihas a validcomponents.json(it was scaffolded byshadcn inititself), but it has no framework config file (next.config.*,vite.config.*, etc.) because the UI library workspace intentionally doesn't ship one — those live inapps/web.preFlightInitthen flags the workspace withUNSUPPORTED_FRAMEWORKand exits.What is the new behavior?
preFlightInitnow treats a providedoptions.existingConfigas proof the project has already been configured for shadcn, and skips the framework detection error in that case. The tailwind-CSS and import-alias checks continue to run normally, so misconfigured projects are still caught.Practical effects:
shadcn apply --preset … -c packages/uinow proceeds past preflight and applies the preset.components.jsonno longer fails withUNSUPPORTED_FRAMEWORKif the framework can't be auto-detected.initbehaviour is unchanged — withoutexistingConfigthe original monorepo detection + error message still apply.Additional context
packages/shadcn/src/preflights/preflight-init.test.tscovering both the new branch (existingConfig present, no framework -> no error) and the pre-existing branch (no existingConfig, no framework -> exits with error).shadcn.