A CLI tool to automatically generate a file to centralize your shadcn/ui component imports.
This CLI tool scans your yours folder and creates a ui.ts file that re-exports everything in an organized way. With this, you get:
- Fewer repetitive imports
- Better code readability
- Cleaner DX experience
import { Button } from "@/components/ui/button"
import { Dialog, DialogTrigger } from "@/components/ui/dialog"
import { AlertDialog, AlertDialogTrigger } from "@/components/ui/alert-dialog"
import { useToast } from "@/components/ui/use-toast"import { ui } from "@/components/ui"
ui.ButtonOr, if you prefer named imports:
import { Button, Dialog, useToast } from "@/components/ui"No more remembering long paths like @/components/ui/alert-dialog. One file to rule them all.
Run the command in the root of your project:
npx shadcn-aliasOr, if you prefer to install globally:
npm install -g shadcn-aliascomponents/
├── ui/
│ ├── button.tsx
│ ├── alert-dialog.tsx
│ └── use-toast.ts
└── ui.ts
MIT License. See LICENSE for details.