Skip to content

Commit 0ad4e3f

Browse files
authored
Merge pull request #66 from pras75299/feat/phase-13-config-split
Feat/phase 13 config split
2 parents d943d54 + 374a303 commit 0ad4e3f

88 files changed

Lines changed: 5728 additions & 5305 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agent/skills/frontend/skill.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ When creating a new component, you **MUST** create/update the following files co
2626
Create the primary source file for the component here.
2727
2. **`apps/www/components/ui/[component-name].tsx`**
2828
Create an exact copy of the source component here so it can be used in the docs/showcase site.
29-
3. **`registry/config.ts`**
30-
Update the registry config to include the new component, specifying its dependencies (e.g., `["motion", "clsx", "tailwind-merge"]`), tailwind properties, and files.
29+
3. **`registry/components/[component-name].json`**
30+
Create the per-component manifest with a `registry` block (dependencies e.g. `["motion", "clsx", "tailwind-merge"]`, `files`, optional tailwind config) and a `docs` block (name, props, scenarios). Add the slug to `order` and `docsOrder` in `registry/manifest.json`.
3131
4. **`apps/www/app/page.tsx`**
3232
Add a functional showcase/demo block of your new component on the main page.
3333
5. **(After Code Generation)**
@@ -118,7 +118,7 @@ export function ComponentName({ className, children, ...props }: ComponentNamePr
118118
## 6. Anti-Patterns (Immediate Failure)
119119

120120
❌ Failing to create the file in BOTH `registry/` and `apps/www/components/ui/`.
121-
❌ Failing to update `registry/config.ts` and `apps/www/app/page.tsx`.
121+
❌ Failing to create `registry/components/[component].json` (+ `registry/manifest.json` order) and `apps/www/app/page.tsx`.
122122
❌ Creating a standard static button without hover/tap spring feedback.
123123
❌ Using standard CSS `transition-all` on everything instead of precise `motion` springs.
124124

@@ -128,7 +128,7 @@ export function ComponentName({ className, children, ...props }: ComponentNamePr
128128

129129
Before finalizing output:
130130
* [ ] Did I create `registry/[component].tsx` and mirror it to `apps/www/components/ui/`?
131-
* [ ] Did I update `registry/config.ts` with the new component metadata?
131+
* [ ] Did I create `registry/components/[component].json` and add the slug to `registry/manifest.json`?
132132
* [ ] Did I add a demo to `apps/www/app/page.tsx`?
133133
* [ ] Does the component have meaningful, purposeful, physics-based motion?
134134
* [ ] Is `motion/react` imported correctly and are styles built entirely with Tailwind CSS?

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Skip this section if your PR doesn't add a component or block.
4242
**Registry sources**
4343

4444
- [ ] `registry/<slug>/component.tsx` created (or `registry/blocks/<category>/<slug>/component.tsx` for blocks)
45-
- [ ] `registry/config.ts` entry added with `name`, `dependencies`, `files`, and `tailwindConfig` (v3) and/or `tailwindCss` (v4) as needed
46-
- [ ] `registry/docs.json` entry added (title, description, category, props)
45+
- [ ] `registry/components/<slug>.json` created — `registry` block (`dependencies`, `files`, `tailwindConfig` v3 and/or `tailwindCss` v4 as needed) + `docs` block (name, description, category, props)
46+
- [ ] Slug added to `order` and `docsOrder` in `registry/manifest.json`
4747
- [ ] `registry/demos.tsx` demo added
4848
- [ ] `pnpm build:registry` run — no `git diff` in `apps/www/public/registry/`, `apps/www/public/r/`, or `apps/www/components/ui/`
4949

BUILD.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ pnpm test -- packages/cli/src/commands/add.test.ts
8585
`registry.json` is a **generated artifact** — never edit it manually.
8686

8787
```bash
88-
pnpm build:registry # Reads registry/<slug>/component.tsx sources → writes registry.json
88+
pnpm build:registry # Aggregates registry/components/<slug>.json + registry/manifest.json
89+
# and registry/<slug>/component.tsx sources → writes registry.json
8990
# Also writes apps/www/public/registry.json
9091
# Also splits per-component files into apps/www/public/registry/
9192
# Also writes shadcn-format registry items to apps/www/public/r/
@@ -96,13 +97,12 @@ pnpm build:registry # Reads registry/<slug>/component.tsx sources → writes
9697

9798
Always commit `registry.json` and the generated files under `apps/www/public/r/` (and the rest of the synced paths) after adding or modifying components, as required by your branch / CI.
9899

99-
### Docs Metadata Storage Decision
100+
### Registry Metadata Storage Decision
100101

101-
`registry/docs.json` remains centralized for now (single source authoring model). This aligns with the current build flow where one registry build command composes and syncs docs artifacts.
102+
Registry metadata is authored as **one manifest per component** under `registry/components/<slug>.json`, with cross-cutting config (demos `sourceFile`, install `order`, docs `docsOrder`) in `registry/manifest.json`. `pnpm build:registry` aggregates these into the generated artifacts.
102103

103-
- Author docs metadata in the centralized file.
104-
- Generated runtime artifacts can still be split per component for delivery.
105-
- Revisit splitting authoring into per-component metadata files only when scaling triggers are hit (see `docs/adr/0001-registry-docs-metadata-storage.md`).
104+
- Each `registry/components/<slug>.json` holds a `registry` block (deps, files, tailwind) and a `docs` block (name, props, scenarios).
105+
- This supersedes the former centralized `registry/config.ts` + `registry/docs.json` model — see [`docs/adr/0002-per-slug-registry-manifests.md`](docs/adr/0002-per-slug-registry-manifests.md) (supersedes ADR 0001).
106106

107107
## Workspaces
108108

CLAUDE.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,13 @@ pnpm test -- packages/cli/src/commands/add.test.ts
138138
### Component Data Flow
139139

140140
```
141-
registry/{component}/component.tsx ← source of truth for component code
142-
↓ (pnpm build:registry)
143-
registry/config.ts ← declares name, npm deps, tailwindConfig per component
144-
141+
registry/{component}/component.tsx ← source of truth for component code
142+
registry/components/{slug}.json ← per-component manifest: build config (deps,
143+
files, tailwind) + docs metadata (name, props,
144+
scenarios). See ADR 0002.
145+
registry/manifest.json ← demos sourceFile + `order` (install order) +
146+
`docsOrder` (docs-site display order)
147+
↓ (pnpm build:registry — aggregates the per-slug manifests)
145148
registry.json ← auto-generated root manifest
146149
apps/www/public/registry/*.json ← auto-generated split docs registry artifacts (uniqueui add)
147150
apps/www/public/r/*.json ← shadcn registry-item JSON (+ r/registry.json manifest)
@@ -174,9 +177,9 @@ Three config files drive the entire docs site:
174177
### Adding a New Component
175178

176179
1. Create `registry/{component-name}/component.tsx`
177-
2. Add entry to `registry/config.ts` (name, dependencies, files array, optional `tailwindConfig` for custom keyframes)
178-
3. Add docs metadata to `registry/docs.json`
179-
4. Add demo to `apps/www/config/demos.tsx` (`componentDemos`)
180+
2. Create `registry/components/{slug}.json` (see ADR 0002 for the shape): a `registry` block (`dependencies`, `files`, optional `tailwindConfig`/`tailwindCss` — do **not** list the shared `cn` util; the build script appends it) and a `docs` block (name, description, icon, props, optional `docs.overview`/`docs.scenarios`).
181+
3. Add the slug to both `order` and `docsOrder` in `registry/manifest.json`.
182+
4. Add demo to `apps/www/config/demos.tsx` (`componentDemos`) — via the `registry/demos.tsx` source.
180183
5. Add an entry to `registry/changelogs.json` under the new slug — at minimum `[{ "version": "1.0.0", "date": "YYYY-MM-DD", "changes": ["Initial release."] }]`. The build script reads `entries[0]` as the component's `meta.version`; entries must be newest-first (descending semver).
181184
6. Run `pnpm build:registry` from root to regenerate `registry.json`, refresh `apps/www/public/registry/*` and **`apps/www/public/r/*`**, sync `apps/www/components/ui/{component-name}.tsx`, and generate `apps/www/config/components.ts` plus `apps/www/config/docs-scenarios.ts`
182185

COMPONENT_LIBRARY.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ Every component in UniqueUI follows a consistent architecture:
189189

190190
```
191191
registry/
192-
└── {component-name}.tsx ← Source component file
193-
registry/config.ts ← Registry metadata (deps, tailwind config)
192+
└── {slug}/component.tsx ← Source component file
193+
registry/components/{slug}.json ← Per-component manifest (deps, tailwind config + docs metadata)
194+
registry/manifest.json ← Demos sourceFile + order + docsOrder
194195
registry.json ← Auto-generated (via build:registry script)
195196
apps/www/components/ui/
196197
└── {component-name}.tsx ← Copy used in the docs site
@@ -307,8 +308,8 @@ uniqueui add typewriter-text
307308

308309
## Contributing a New Component
309310

310-
1. Create `registry/{component-name}.tsx`
311-
2. Add entry to `registry/config.ts` with dependencies and tailwind config
311+
1. Create `registry/{slug}/component.tsx`
312+
2. Create `registry/components/{slug}.json` (dependencies, tailwind config + docs metadata) and add the slug to `order`/`docsOrder` in `registry/manifest.json`
312313
3. Run `pnpm build:registry` to regenerate `registry.json`
313314
4. Add a showcase demo in `apps/www/app/page.tsx`
314315
5. Test with `uniqueui add {component-name}` in a fresh project

CONTRIBUTING.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ pnpm dev # Docs site at localhost:3000
2929
| Directory | Purpose |
3030
|-----------|---------|
3131
| `registry/` | Component source files — single source of truth |
32-
| `registry/config.ts` | Component registry definition (name, deps, tailwind config) |
32+
| `registry/components/<slug>.json` | Per-component manifest: build config (deps, files, tailwind) + docs metadata. See [ADR 0002](docs/adr/0002-per-slug-registry-manifests.md) |
33+
| `registry/manifest.json` | Demos `sourceFile` + `order` (install order) + `docsOrder` (docs-site display order) |
3334
| `packages/cli/` | `uniqueui-cli` npm package — handles `uniqueui add <component>` |
3435
| `apps/www/` | Next.js docs/showcase site |
3536
| `scripts/` | Build scripts (registry generation, pre-commit hook) |
3637

3738
## Adding a New Component
3839

3940
1. Create `registry/<component-name>/component.tsx` with the component source
40-
2. Add an entry to `registry/config.ts` with `name`, `dependencies`, `files`, and optional `tailwindConfig`
41-
3. Add docs metadata to `registry/docs.json` for the component page and scenarios
41+
2. Create `registry/components/<slug>.json` — a `registry` block (`dependencies`, `files`, optional `tailwindConfig`/`tailwindCss`; the shared `cn` util is appended automatically, so don't list it) and a `docs` block (name, description, icon, props, optional `docs.overview`/`docs.scenarios`). See [ADR 0002](docs/adr/0002-per-slug-registry-manifests.md)
42+
3. Add the slug to both `order` and `docsOrder` in `registry/manifest.json`
4243
4. Add the live demo mapping to `registry/demos.tsx`
4344
5. Run `pnpm build:registry` from the root — this regenerates `registry.json`, refreshes `apps/www/public/registry/*` and **`apps/www/public/r/*`** (shadcn registry URLs), syncs `apps/www/components/ui/*`, and generates `apps/www/config/components.ts`, `apps/www/config/docs-scenarios.ts`, and `apps/www/config/demos.tsx`
4445
6. Test in the docs site: `cd apps/www && pnpm dev`
@@ -47,12 +48,12 @@ pnpm dev # Docs site at localhost:3000
4748

4849
| Source (edit these) | Generated (do not edit by hand) |
4950
|---------------------|----------------------------------|
50-
| `registry/docs.json` | `apps/www/config/components.ts`, `apps/www/config/docs-scenarios.ts` |
51+
| `registry/components/<slug>.json` | `apps/www/config/components.ts`, `apps/www/config/docs-scenarios.ts` |
5152
| `registry/demos.tsx` | `apps/www/config/demos.tsx` |
5253

53-
- **Policy:** Keep docs metadata authoring centralized in `registry/docs.json` unless a [documented migration](docs/adr/0001-registry-docs-metadata-storage.md) has happened. The ADR lists quantitative **migration triggers** (file size, conflict rate, ownership needs) and qualitative **friction signals** — open a discussion if friction grows, but do not split metadata files until triggers are met.
54-
- **When the model changes:** If an ADR supersedes 0001 (for example per-component `registry/<slug>/docs.json`), update this section, `BUILD.md`, and any `scripts/build-registry.ts` / CI drift checks in the same change series so contributors have a single coherent story.
55-
- After any edit to `registry/docs.json` or `registry/demos.tsx`, run `pnpm build:registry` and commit generated files under `apps/www/config/`, `apps/www/components/ui/`, `apps/www/public/registry/`, **`apps/www/public/r/`**, and root `registry.json` as required by CI.
54+
- **Model:** Registry metadata is authored as one manifest per component under `registry/components/<slug>.json`, aggregated by `scripts/build-registry.ts`. This supersedes the centralized `registry/docs.json` model — see [ADR 0002](docs/adr/0002-per-slug-registry-manifests.md) (which supersedes [ADR 0001](docs/adr/0001-registry-docs-metadata-storage.md)).
55+
- **When the model changes:** If a future ADR supersedes 0002, update this section, `BUILD.md`, and any `scripts/build-registry.ts` / CI drift checks in the same change series so contributors have a single coherent story.
56+
- After any edit under `registry/components/`, `registry/manifest.json`, or `registry/demos.tsx`, run `pnpm build:registry` and commit generated files under `apps/www/config/`, `apps/www/components/ui/`, `apps/www/public/registry/`, **`apps/www/public/r/`**, and root `registry.json` as required by CI.
5657

5758
## Component Design Rules
5859

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ Registry (GitHub)
522522
Your project (shadcn components.json, @/lib/utils)
523523
```
524524

525-
1. **Registry** — Each component is defined in `registry/config.ts` and points at files like `registry/<slug>/component.tsx`. `build-registry.ts` outputs `registry.json`, split files under `apps/www/public/registry/`, **shadcn-format items under `apps/www/public/r/`**, and synced docs UI copies.
525+
1. **Registry** — Each component is defined in `registry/components/<slug>.json` (build config + docs metadata) and points at files like `registry/<slug>/component.tsx`. `build-registry.ts` aggregates these (ordered by `registry/manifest.json`) and outputs `registry.json`, split files under `apps/www/public/registry/`, **shadcn-format items under `apps/www/public/r/`**, and synced docs UI copies.
526526
2. **UniqueUI CLI** — Fetches the hosted registry, writes files to your project, and installs npm dependencies (and can add `utils/cn.ts`).
527527
3. **shadcn CLI** — Consumes the same component source via `public/r/<slug>.json` URLs; expects a standard shadcn project layout and `@/lib/utils` for `cn`.
528528
4. **Showcase** — The `apps/www` Next.js site serves as marketing landing page and component documentation with live previews and install commands.
@@ -570,8 +570,8 @@ node --version # must be v18 or higher
570570

571571
1. Fork the repository
572572
2. Create your feature branch (`git checkout -b feature/my-component`)
573-
3. Add your component to `registry/` and update `registry/config.ts`
574-
4. Update `registry/docs.json` for docs metadata and `apps/www/config/demos.tsx` for the live demo
573+
3. Add your component to `registry/` and create `registry/components/<slug>.json` (build config + docs metadata), then add the slug to `order` and `docsOrder` in `registry/manifest.json`
574+
4. Add the live demo mapping in `registry/demos.tsx`
575575
5. Run `pnpm build:registry` to regenerate `registry.json`, refresh `apps/www/public/registry/*` and **`apps/www/public/r/*`**, sync `apps/www/components/ui/*`, and generate `apps/www/config/components.ts` plus `apps/www/config/docs-scenarios.ts`
576576
6. Run `pnpm build` to ensure everything compiles
577577
7. Submit a pull request

apps/www/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ When you ship an intentional visual change:
8585
If you are adding or changing a component, start in the repo root:
8686

8787
- component source: `registry/<slug>/component.tsx`
88-
- docs metadata: `registry/docs.json`
88+
- build config + docs metadata: `registry/components/<slug>.json` (ordered by `registry/manifest.json`)
8989
- demo mappings: `registry/demos.tsx`
9090

9191
Contributor workflow details live in the root [`CONTRIBUTING.md`](../../CONTRIBUTING.md) and [`BUILD.md`](../../BUILD.md).

0 commit comments

Comments
 (0)