|
1 | | -# Blocks |
| 1 | +# Blocks docs |
2 | 2 |
|
3 | | -Docs and live-demo showcase for the **Constructive blocks registry** — the `@constructive` shadcn registry of data-bound blocks and UI primitives. Every block renders as a real, interactive demo next to its install command, props, and source. |
| 3 | +This Next.js app is the clean documentation surface for the Constructive UI foundation. It intentionally exposes only |
| 4 | +the landing page, setup guidance, and the 29 base primitive pages while the complete block catalog remains available |
| 5 | +through the public registry. |
4 | 6 |
|
5 | | -Live: **https://constructive-io.github.io/blocks/** (GitHub Pages, static export under basePath `/blocks`). |
| 7 | +The same primitive implementation is shown through two distribution modes: |
6 | 8 |
|
7 | | -## Develop |
| 9 | +- npm consumers import `@constructive-io/ui/<name>` and the package stylesheet. |
| 10 | +- shadcn consumers install `@constructive/<name>` as editable source without preinstalling the npm package. |
| 11 | + |
| 12 | +## Development |
8 | 13 |
|
9 | 14 | ```bash |
10 | | -pnpm --filter blocks dev # Next.js + Turbopack on http://localhost:3005 |
| 15 | +pnpm --filter blocks dev |
| 16 | +pnpm --filter blocks lint:types |
| 17 | +pnpm --filter blocks test |
| 18 | +pnpm --filter blocks build:pages |
11 | 19 | ``` |
12 | 20 |
|
13 | | -`predev` regenerates artifacts first, so the dev server always reflects current content. |
14 | | - |
15 | | -## Content model |
16 | | - |
17 | | -Docs are **generated from source**, not hand-written per page. Authored inputs and the UI/schema package manifests feed two generators: |
18 | | - |
19 | | -| Authored input | Generator | Generated output (DO NOT EDIT) | |
20 | | -|----------------|-----------|--------------------------------| |
21 | | -| `src/content/blocks/*.md`, `catalog/blocks.json`, all three registry manifests, sidecar `scripts/*content*.mjs` | `scripts/generate-manifest.mjs` | `src/blocks-manifest.json`, `src/lib/docs/registry-data.ts` | |
22 | | -| `scripts/flows-content.mjs`, `registry.json` | `scripts/generate-flows.mjs` | `src/flows/flows.json` | |
23 | | - |
24 | | -Run `pnpm gen` after changing any authored input. Never edit the generated files directly — `pnpm gen:check` re-runs the generators into a temp dir and fails on any drift. It runs in `prebuild` and in CI, so drift blocks the build. |
25 | | - |
26 | | -## Scripts |
27 | | - |
28 | | -| Script | Does | |
29 | | -|--------|------| |
30 | | -| `gen` | Regenerate manifest, docs data, and flows | |
31 | | -| `gen:check` | Fail if generated files drift from their sources | |
32 | | -| `check:flows` | Validate `flows.json`, namespaced installs, and pruned SDK fixtures | |
33 | | -| `fixtures:refresh` | Refresh reachable SDK fixtures from an explicit generated source root | |
34 | | -| `fixtures:check` | Fail when generated SDK imports drift from committed fixtures | |
35 | | -| `check:selections` | Reject empty mutation selections in `src/blocks` | |
36 | | -| `lint:types` | `tsc --noEmit` | |
37 | | -| `test` | `vitest run` | |
38 | | -| `test:visual` | Compare the static Pages site with the Playwright screenshot baselines | |
39 | | -| `build:pages` | `BLOCKS_PAGES=1 next build` — static export for GitHub Pages | |
40 | | - |
41 | | -## Layout |
42 | | - |
43 | | -| Path | Role | |
44 | | -|------|------| |
45 | | -| `src/blocks` | Registry-shipped app block source (auth, org, user, chat, primitives, runtime, …) | |
46 | | -| `src/generated` | Pruned, committed generated SDK fixtures used only by docs and tests | |
47 | | -| `src/components/docs` | Docs site chrome — nav, preview frame, code surface, demos | |
48 | | -| `src/app` | Next.js App Router routes | |
49 | | -| `src/content/blocks` | Authored per-block markdown (generator input) | |
50 | | -| `scripts` | Generators + drift/contract guards | |
51 | | - |
52 | | -`src/blocks` is the source shadcn ships to consumers; everything else is the site that documents it. |
53 | | - |
54 | | -## Deploy |
| 21 | +`src/lib/base-primitives.ts` is the single docs catalog. `pnpm gen:check` validates that every entry has an npm export, |
| 22 | +a registry item, and a preview that imports the npm subpath. The SDK fixture and mutation-selection checks remain in |
| 23 | +place for the canonical block source under `src/blocks`. |
55 | 24 |
|
56 | | -`.github/workflows/ci.yml` runs the repository validation suite. On `main`, |
57 | | -`.github/workflows/pages.yml` repeats the validated build, assembles `_site/` — |
58 | | -the Blocks site plus registry JSON under `/r/` — and deploys it to GitHub Pages. |
59 | | -Neither workflow publishes npm packages. |
| 25 | +The static Pages build uses `/blocks` as its deployment base path. Publishing npm packages remains a separate manual |
| 26 | +release step. |
0 commit comments