Registry
The generated manifest the CLI installs from, and what it records about each component.
registry.json and the per-component files under /r/ are generated by
scripts/build-registry.mjs from the components themselves. Nothing is written by hand, and the
schema is shadcn's, so their CLI installs from it
directly.
An item
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "button",
"type": "registry:ui",
"dependencies": ["@base-ui/react", "class-variance-authority"],
"registryDependencies": [],
"files": [{
"path": "registry/qure/ui/button.tsx",
"target": "components/ui/button.tsx",
"type": "registry:ui"
}]
}dependencies and registryDependencies are both parsed out of the source — the npm packages
from its imports, the sibling components from its @/registry/qure/ui/* imports. There is no
list to forget to update.
Regenerating
node scripts/build-registry.mjsRun it after adding a component or an example. It writes three things:
registry/__index__.tsx— the example map the docs previews readpublic/r/<name>.json— one installable item per componentregistry.json— the index of all of them
Why previews cannot lie
The generated index pairs each example's component with the text of the same file:
'button-demo': {
component: button_demo,
source: "import { Button } from '@/registry/qure/ui/button'\n\n…",
}So the code under View code is the code that just rendered above it. There is no second copy to fall out of date.