@gamecn/registry-builder
v0.0.7
Published
Workspace-internal source for the `gamecn-registry` CLI. **The published package on npm is named `gamecn-registry` (unscoped) and is built from this directory's source.**
Readme
@gamecn/registry-builder
Workspace-internal source for the gamecn-registry CLI. The published package on npm is named gamecn-registry (unscoped) and is built from this directory's source.
Run from source
bun run src/cli.ts validate --src registry
bun run src/cli.ts build --src registry --out registry-dist --base-url https://example.com
bun run src/cli.ts dev --port 8787Build the published bundle
bun run build # bun build src/cli.ts → dist/cli.js
bun run publish:dry # build + npm pack --dry-run from dist/
bun run publish:npm # build + npm publish from dist/What the builder does
Given a source tree of items (registry/<engine>/<name>/item.json + companion files):
- Walks every directory containing
item.json. Skips dirs flagged.gamecn-skip. - Validates each item against
RegistryItemSchema. All errors collected in a single pass. - Inlines text files ≤ 64KB into the emitted manifest (
contentfield). - Hashes binary files by sha256, copies them to
<out>/assets/<sha256>, and emits absolute URL + SRI integrity in the manifest. - Dedupes content-addressed assets — same bytes appear once on disk no matter how many items reference them.
- Emits per-item manifests at
<out>/r/<item-name>.jsonand the index at<out>/registry.json. - Warns on dangling internal registry deps (intra-registry bare names that don't resolve).
Output:
<out>/
registry.json # index of all items
r/<item-name>.json # full per-item manifests (text inlined, binaries by URL+SRI)
assets/<sha256> # content-addressed binary assets
previews/<item>.png # preview thumbnailsAuthoring guide
See registry/README.md for the source-tree convention and deploy notes.
Source layout
src/
walk.ts find item.json files in a tree
build.ts buildRegistry() + validateRegistry() core logic
cli.ts commander bootstrap with build / validate / dev subcommands
index.ts library exports