shadcn-svelte icon indicating copy to clipboard operation
shadcn-svelte copied to clipboard

Monorepo Support

Open xmlking opened this issue 1 year ago • 8 comments

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

xmlking avatar Dec 24 '24 03:12 xmlking

Please let us know if anyone is working on this feature

pbk0 avatar Feb 18 '25 19:02 pbk0

This will be a part of the updates that come with Tailwind v4

huntabyte avatar Feb 19 '25 15:02 huntabyte

How is this feature coming along. If there is an area where hands are needed just give the signal. @huntabyte

Fractal-Tess avatar Apr 17 '25 20:04 Fractal-Tess

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!

huntabyte avatar May 18 '25 23:05 huntabyte

  1. Create a new turborepo project with CLI similar to https://ui.shadcn.com/docs/monorepo
  2. npx shadcn-svelte@next add button, the CLI will install the button component under packages/ui and update the import path for components in apps/web.

https://x.com/shadcn/status/1870157493684580444?s=61&t=prjj5Lm6MXpnSZaenY1B-A

example monorepo: https://github.com/xmlking/spectacular

xmlking avatar May 19 '25 01:05 xmlking

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

Pandoks avatar May 24 '25 01:05 Pandoks

created a sample monorepo that currently shares shadcn-svelte components with some workarounds here

Pandoks avatar May 26 '25 08:05 Pandoks

I manually setup similar to shadcn/ui monorepo template if anyone need example repo: apps/smart packages/ui

xmlking avatar Jun 02 '25 06:06 xmlking