How authors turn a kit source tree into a consumable CDN digest.
kit source (components/ui, blocks, …)
│
▼
ui8kit scan → src/registry.json (manifest: paths + deps metadata)
│
▼
ui8kit build → packages/registry/r/**/*.json + index.json
│
▼
static host / npm package / GitHub raw / unpkg
│
▼
consumers: ui8kit init / add --registry-url …
- Kit layout roughly matches canonical folders under
src/(or adjust scan defaults) - Files that should ship are exportable modules (scan skips files without
export) - Node
>=20for the CLI
From the kit repository root:
npx ui8kit scan --source src --output src/registry.jsonReview src/registry.json:
- Correct
typeper item dependencies/registryDependencieslook right- Paths point at real files
npx ui8kit build src/registry.json --output packages/registry/rVerify:
ls packages/registry/r/index.json
ls packages/registry/r/components/ui/Each item JSON must include embedded files[].content.
# from packages/registry parent so /r is the URL path
cd packages/registry
python -m http.server 4173Consumer test:
cd /path/to/app
npx ui8kit init --yes --framework none --dir src --skip-core \
--registry-url http://127.0.0.1:4173/r --strict-cdn
npx ui8kit add button --registry-url http://127.0.0.1:4173/r --strict-cdnOr use the maintainer smoke scripts (needs local .workflow fixtures): see scripts/README.md.
Any static host works. Examples:
npm package @ui8kit/registry with files under r/:
https://unpkg.com/@ui8kit/registry@0.1.0/r/index.json
Custom CDN:
https://cdn.example.com/ui8kit/0.1.0/r/index.json
Document the base URL (…/r) for consumers.
npx ui8kit registry clean --force
npx ui8kit scan …
npx ui8kit build …--all also removes src/registry.json.
Options:
- One JSON per brick, all stacks inside — consumers use
--runtimefor file-level filter (recommended for codegen digests) - Separate packages / URL prefixes per runtime (
…/svelte/r,…/react/r) - Tagged digests via
registryVersion/ npm dist-tags - Item-level
runtimefield — consumer--runtimeskips mismatched items on a shared index
Prefer immutable URLs for production apps (@0.1.0, content-hashed paths).
- No Tailwind utility-map generation
- No JSON Schema codegen into
packages/registry/schema - No TypeScript program analysis beyond simple import/export text scans on
scan
Keep kit-specific transforms in codegen; keep this CLI as delivery + assembly.