Monorepo Support
Prerequisites
- [X] This feature already exists in shadcn/ui - if not, it won't be considered here so don't continue with your issue.
Describe the feature
pnpm dlx shadcn-svelte@next init should offer option for Monorepo like pnpm dlx shadcn@canary init
https://ui.shadcn.com/docs/monorepo
Please let us know if anyone is working on this feature
This will be a part of the updates that come with Tailwind v4
How is this feature coming along. If there is an area where hands are needed just give the signal. @huntabyte
Now that we have the big lift of Tailwind v4 done, I'd like to get some more details as to what it is specifically you're looking for regarding "monorepo" support.
The more specific the usage example is the better chance we have of making it happen!
- Create a new turborepo project with CLI similar to https://ui.shadcn.com/docs/monorepo
npx shadcn-svelte@next add button, the CLI will install the button component underpackages/uiand update the import path for components inapps/web.
https://x.com/shadcn/status/1870157493684580444?s=61&t=prjj5Lm6MXpnSZaenY1B-A
example monorepo: https://github.com/xmlking/spectacular
the way that react shadcn works is that for each workspace that uses shadcn, they have their own components.json. No matter what workspace you're in that has a component.json, if you install a component, it will install it via the original ui component library in the monorepo.
you can mimic this behavior if you use the -c option right now and pointing it to the ui component repo: pnpm dlx shadcn-svelte@next add <component> -c <path to component lib>
it would be nice if we can have similar behavior to the react shadcn monorepo support where it figure it out for you depending on the components.json.
right now my workaround is have have the -c in a package.json script and when I want to add a component i just run pnpm run shadcn <component> which runs: pnpm dlx shadcn-svelte@next add $@ -c <path to component lib>.
created a sample monorepo that currently shares shadcn-svelte components with some workarounds here
I manually setup similar to shadcn/ui monorepo template if anyone need example repo: apps/smart packages/ui