-
Notifications
You must be signed in to change notification settings - Fork 163
feat: add shadcn component registry #723
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| paths: | ||
| - "src/components/ui/**" | ||
| - "src/components/form/**" | ||
| - "src/hooks/**" | ||
| - "src/lib/tailwind/utils.ts" | ||
| - "src/lib/dayjs/parse-string-to-date.ts" | ||
| --- | ||
|
|
||
| When you add, rename, or remove a component in `src/components/ui/`, `src/components/form/`, `src/hooks/`, or a registry lib (`src/lib/tailwind/utils.ts`, `src/lib/dayjs/parse-string-to-date.ts`), you MUST update `registry.json` at the project root to keep the shadcn registry in sync. | ||
|
|
||
| Checklist: | ||
| 1. **New component** → Add a new item in `registry.json` with correct `name`, `type`, `dependencies`, `registryDependencies`, and `files`. | ||
| 2. **Renamed/moved component** → Update the corresponding `files[].path` in `registry.json`. | ||
| 3. **Deleted component** → Remove the item from `registry.json` and remove it from other items' `registryDependencies`. | ||
| 4. **Changed imports** → If a component gains or loses an npm dependency or an internal dependency on another registry component, update `dependencies` and `registryDependencies` accordingly. | ||
| 5. **Rebuild** → Run `pnpm registry:build` after changes to verify the build succeeds. | ||
|
|
||
| Registry item types: | ||
| - `registry:ui` for `src/components/ui/` components | ||
| - `registry:component` for `src/components/form/` components | ||
| - `registry:hook` for `src/hooks/` hooks | ||
| - `registry:lib` for utility libraries |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| /dist | ||
| /build | ||
| /public/storybook | ||
| /public/r | ||
| /storybook-static | ||
|
|
||
| # misc | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -15,7 +15,39 @@ Thank you for considering contributing to this repository! | |||||
| > Write a good commit message. | ||||||
| > Also, make sure that the linting is correct. | ||||||
|
|
||||||
| ## Component Registry | ||||||
|
|
||||||
| Start UI exposes a [shadcn registry](https://ui.shadcn.com/docs/registry) so that components can be installed individually in other projects. | ||||||
|
|
||||||
| ### How it works | ||||||
|
|
||||||
| - `registry.json` at the project root defines every registry item (UI components, form fields, hooks, libs). | ||||||
| - `pnpm registry:build` generates JSON files in `public/r/` from that definition. | ||||||
| - In production, the registry is served at `https://demo.start-ui.com/r/<name>.json`. | ||||||
|
|
||||||
| ### Keeping the registry up to date | ||||||
|
|
||||||
| Whenever you **add, rename, move, or delete** a component in `src/components/ui/`, `src/components/form/`, or `src/hooks/`, you must update `registry.json`: | ||||||
|
|
||||||
| | Action | What to do in `registry.json` | | ||||||
| |---|---| | ||||||
| | Add a component | Add a new item with `name`, `type`, `files`, `dependencies`, `registryDependencies` | | ||||||
| | Rename/move a component | Update the `files[].path` entry | | ||||||
| | Delete a component | Remove the item and remove it from other items' `registryDependencies` | | ||||||
| | Change a component's imports | Update `dependencies` (npm packages) and `registryDependencies` (other registry items) | | ||||||
|
|
||||||
| After changes, run `pnpm registry:build` to verify the build succeeds. | ||||||
|
|
||||||
| ### Registry item types | ||||||
|
|
||||||
| | Type | Used for | | ||||||
| |---|---| | ||||||
| | `registry:ui` | Components in `src/components/ui/` | | ||||||
| | `registry:component` | Components in `src/components/form/` | | ||||||
| | `registry:hook` | Hooks in `src/hooks/` | | ||||||
| | `registry:lib` | Utility libraries (e.g. `cn`, `parse-string-to-date`) | | ||||||
|
|
||||||
| ## Translations | ||||||
|
|
||||||
| You only need to maintain the english and french translations for you PR. | ||||||
| You only need to maintain the english and french translations for you PR. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo: "you PR" → "your PR". ✏️ Proposed fix-You only need to maintain the english and french translations for you PR.
+You only need to maintain the English and French translations for your PR.📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[grammar] ~52-~52: Ensure spelling is correct (QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1) 🤖 Prompt for AI Agents |
||||||
| Other language translations are not required to submit a PR 😉 | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the standard way of exposing registry components:
When building the registry, json files are created and placed in
public/r/<comp>.jsonSince it is generated automatically via the registry.json file, no need to push it on the repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: https://ui.shadcn.com/docs/registry/getting-started#run-the-build-script