Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat]: remove/rm/delete components using CLI #6348

Open
2 tasks done
rohith02b opened this issue Jan 14, 2025 · 2 comments
Open
2 tasks done

[feat]: remove/rm/delete components using CLI #6348

rohith02b opened this issue Jan 14, 2025 · 2 comments

Comments

@rohith02b
Copy link

Feature description

As we have npx shadcn@latest add , why not have a npx shadcn@latest remove/rm/delete using the cli.

Here is how this feature would work:

  1. User hits the npx shadcn@latest remove/rm/delete .
  2. Search if the component exists in the user's directory.
  3. Only remove the component if it exists inside the UI folder
  4. If it does not exist in the UI folder, throw error stating the component does not exist -> Add it using npx shadcn@latest add .

Affected component/components

None

Additional Context

@shadcn Please check this out!

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues and PRs
@rohith02b rohith02b changed the title [feat]: delete/remove components using CLI [feat]: remove/rm/delete components using CLI Jan 14, 2025
@shadcn
Copy link
Collaborator

shadcn commented Jan 14, 2025

I'm considering this but this is a tricky problem to solve because we don't track (intentionally) where components are installed from.

Consider the following case npx shadcn add alert-dialog which adds components/ui/alert-dialog.tsx and a components/ui/button.tsx dependency. How do we reliably figure out the button dependency to remove when removing alert-dialog without a dependency tree?

This gets even more complex if you're pulling a block from a registry with multiple nested dependencies.

Having a remove command is something that should exist but in practice using git to track added files is much easier.

@rohith02b
Copy link
Author

Thanks for checking this out, do let me know if you figure something out.
Meanwhile, I will also try to find a solution for this as this might improve developer experience.

PS: Shadcn is the best thing that has happened to the front-end community.

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

No branches or pull requests

2 participants