-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
Hello everyone!
Right now, to overwrite a component using shadcn as a cli, you can use the --overwrite
flag.
pnpm dlx shadcn@latest add [component] --overwrite
However, this flag is not bypassed by ai-elements to the final spawnSync execution.
const fullCommand = `${commandPrefix} shadcn@latest add ${targetUrl}`;
const result = spawnSync(fullCommand, {
stdio: "inherit",
shell: true,
});
Which means, you cannot use ai-elements
's add
command if you have the component already.
I would like to suggest two possible approaches:
1. Natively supported the --overwrite
flag.
Please consider this approach needs support each flag you want to integrate from shadcn's cli.
pnpm dlx ai-elements@latest add [component] --overwrite
2. By pass extra arguments to shadcn directly.
Less idiomatic, but gives more control to the user.
pnpm dlx ai-elements@latest add [component] -- --overwrite
Steps to reproduce this issue

In an empty next.js project, run:
# install
pnpm dlx ai-elements@latest
# add some component
pnpm dlx ai-elements@latest add actions
# add the same component again
pnpm dlx ai-elements@latest add actions --overwrite
## ... note the cli skips the component since is already there
Thanks for reading!
Ronny
Metadata
Metadata
Assignees
Labels
No labels