Skip to content

fix(cli): allow apply in monorepo UI workspaces without framework config#10424

Open
yogeshwaran-c wants to merge 1 commit intoshadcn-ui:mainfrom
yogeshwaran-c:fix/cli-apply-monorepo-v2
Open

fix(cli): allow apply in monorepo UI workspaces without framework config#10424
yogeshwaran-c wants to merge 1 commit intoshadcn-ui:mainfrom
yogeshwaran-c:fix/cli-apply-monorepo-v2

Conversation

@yogeshwaran-c
Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix.

What is the current behavior?

Closes #10411

Running shadcn apply -c packages/ui (or bunx shadcn@latest apply --preset … -c packages/ui) from a shadcn-generated monorepo fails with:

We could not detect a supported framework at /.../packages/ui.
Visit https://ui.shadcn.com/docs/installation/manual to manually configure your project.
Once configured, you can use the cli to add components.

The target packages/ui has a valid components.json (it was scaffolded by shadcn init itself), but it has no framework config file (next.config.*, vite.config.*, etc.) because the UI library workspace intentionally doesn't ship one — those live in apps/web. preFlightInit then flags the workspace with UNSUPPORTED_FRAMEWORK and exits.

What is the new behavior?

preFlightInit now treats a provided options.existingConfig as 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/ui now proceeds past preflight and applies the preset.
  • Any re-init on a project that already has a components.json no longer fails with UNSUPPORTED_FRAMEWORK if the framework can't be auto-detected.
  • First-time init behaviour is unchanged — without existingConfig the original monorepo detection + error message still apply.

Additional context

  • A regression test was added at packages/shadcn/src/preflights/preflight-init.test.ts covering both the new branch (existingConfig present, no framework -> no error) and the pre-existing branch (no existingConfig, no framework -> exits with error).
  • A patch changeset was added for shadcn.

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.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 17, 2026

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: shadcn-cli "apply" command does not work in monorepo

1 participant