components-differ
v1.2.5
Published
CLI to generate shadcn registry items from git diffs
Readme
components-differ
CLI to generate shadcn-compatible registry items (registry:block) from your project.
You can use it in two ways:
- Folder mode (default): create a registry item from every file in a folder (default: current directory).
- Git mode (
--git): create a registry item from files changed since the initial git commit.
Install & build
From the differ folder:
npm install -g components-differAfter building, you can run the CLI with node or via the components-differ bin (if linked/installed).
Default: folder mode (current directory)
Run with no arguments to generate a registry item from the current folder (and all files it imports):
# from your project root – includes whole project and resolves imports
components-differ > block.json
# optional name
components-differ -n my-block > block.jsonOr target a specific folder:
components-differ --folder src/app/dashboard -n dashboard-block > block.json
components-differ --folder src/app/dashboard > block.jsonGit mode (changed files only)
Use --git when you want a registry item only from files changed since the initial commit:
# initialize a clean git history first
components-differ --init
# after making changes, generate from changed files only
components-differ --git -n my-block > block.jsonAdd the block locally
npx shadcn add ./block.jsonOptions summary
--init: initialize a clean git repo and first commit (for use with--gitlater).-n, --name <name>: registry item name; defaults to current (or folder) name.-f, --folder <folder>: folder to include (default: current directory). Ignored if--gitis set.--git: use git mode (only files changed since initial commit).
