Skip to content

euotiniel/shadcn-alias

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shadcn-alias

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

Before

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"

After

import { ui } from "@/components/ui"

ui.Button

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

Usage

Run the command in the root of your project:

npx shadcn-alias

Or, if you prefer to install globally:

npm install -g shadcn-alias

Example structure

components/
├── ui/
│   ├── button.tsx
│   ├── alert-dialog.tsx
│   └── use-toast.ts
└── ui.ts

License

MIT License. See LICENSE for details.

About

A CLI tool to automatically generate a file to centralize your shadcn/ui component imports.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published