ui icon indicating copy to clipboard operation
ui copied to clipboard

Change default ui directory

Open riccardolardi opened this issue 10 months ago • 18 comments

Is it possible to change the default ui directory? I'd like the CLI to install new components into @/components/ui-library instead of @/components/ui. Thanks

riccardolardi avatar Aug 09 '23 08:08 riccardolardi

According to CLI docs, there's a -p (or --path) option that should do the trick, however after testing it, that didn't work. It keeps installing the component in the /src/components/ui folder.

Here's what I have tried:

npx shadcn-ui add --path /src/components/ui-library alert
npx shadcn-ui add --path /src/components/ui-library alert
npx shadcn-ui add -p /ui-library alert

https://ui.shadcn.com/docs/cli brave_QlhsvsdATn

There exist many issues related to this bug if you need more info. Here's one of them: https://github.com/shadcn-ui/ui/issues/848#issuecomment-1622524000

mohamedaleya avatar Aug 09 '23 08:08 mohamedaleya

This is something I'm looking into. It's currently hardcoded to UI but definitely something that we'll make configurable. Assigning this to me.

shadcn avatar Aug 09 '23 19:08 shadcn

Any update on this @shadcn?

Stefandasbach avatar Sep 21 '23 18:09 Stefandasbach

@Stefandasbach I haven't had time to look into it yet. For now, as a workaround, you can provide --path when adding components.

-p, --path <path>  the path to add the component to.

shadcn avatar Sep 22 '23 03:09 shadcn

Looks like this still isn't working with npx shadcn-ui add <component> --path <path> either.

mindofjonas avatar Sep 23 '23 17:09 mindofjonas

The workaround doesn't work as well :( I hope this option is enabled soon so adoption for existing projects is easier.

nopitown avatar Oct 11 '23 19:10 nopitown

Bumping this up, would love to be able to configure a default path on components.json for CLI to reference

claudfuen avatar Oct 11 '23 20:10 claudfuen

Bump this again, really need this kind of feature

datproto avatar Oct 25 '23 08:10 datproto

Bump this again, really need this kind of feature

artemshchirov avatar Oct 26 '23 15:10 artemshchirov

Bump this again, really need this kind of feature

dinwwwh avatar Dec 01 '23 09:12 dinwwwh

Hoping to have this soon

rogerrc12 avatar Dec 07 '23 19:12 rogerrc12

Bumping again pls add

claudfuen avatar Dec 07 '23 20:12 claudfuen

Change the path setting in the components.json then run the cli again.

josephdburdick avatar Dec 07 '23 22:12 josephdburdick

Any update on this @shadcn?

victorharry avatar Dec 16 '23 19:12 victorharry

@shadcn I know you're busy but I tracked down the line which seems to be blocking the workaround I hesitate to open a PR for it though since it's there for a reason I guess? https://github.com/shadcn-ui/ui/blob/1cf5fad881b1da8f96923b7ad81d22d0aa3574b9/packages/cli/src/utils/registry/index.ts#L121

joemcbroom avatar Dec 18 '23 04:12 joemcbroom

Update: Back from vacation. Working on this now.

shadcn avatar Dec 18 '23 04:12 shadcn

@shadcn if it's a simple fix but you don't have time to work on it, let me know I'd love to sync on it and be able to contribute. And I'm on PTO this week so have the time :)

joemcbroom avatar Dec 26 '23 05:12 joemcbroom

#2266 closes this

schulzf avatar Jan 08 '24 12:01 schulzf

Yes. I believe this is fixed #2266. Please reopen if not. Thank you.

shadcn avatar Mar 05 '24 05:03 shadcn