Build orchestrator for examples.xyd.dev — turns every example in
xyd-js/examples into a single static
site whose subpaths map to individual examples:
examples.xyd.dev/abtestingexamples.xyd.dev/custom-jsexamples.xyd.dev/openapi- … etc.
examples/is a git submodule pointing atxyd-js/examples.- On startup,
scripts/build-all.tsinstalls@xyd-js/cli@$XYD_CLI_VERSIONonce into.cli-cache/so concurrent runs share a single binary (avoidsbunxracing on the global cache). - It then discovers every directory with a
docs.jsonand builds them concurrently (default:availableParallelism()/2, configurable via--concurrency=NorCONCURRENCY=N). Each build:- patches
docs.jsonsoadvanced.basename = "/<slug>"; - runs
xyd build(in-place, so sibling refs like../.snippets/*resolve); - restores the original
docs.json.
- patches
- Each build's
.xyd/build/client/*is merged intodist/. The merge step is serialized so concurrent builds don't race ondist/assets/. - A small landing page (
landing/) is rendered todist/index.html. - Netlify publishes
dist/.
The basename example is special-cased: its existing /my-base is preserved,
so it lives at examples.xyd.dev/my-base/ and the landing page calls that
out.
A failing example is logged and skipped — the deploy still ships the rest.
One-shot (init submodules → install → build → serve):
git clone git@github.com:xyd-js/examples-build
cd examples-build
./scripts/run-local.sh # all 18 examples, serves at :4321
./scripts/run-local.sh abtesting # build a single example
./scripts/run-local.sh abtesting,basename
NO_SERVE=1 ./scripts/run-local.sh # build only
PORT=8080 ./scripts/run-local.sh # custom portOr step by step (after git clone --recurse-submodules):
bun install
bun run build # → dist/
bun run serve # → http://localhost:4321
bun run build:only=abtesting,basename # subset
bun run discover # list slug → mountedAtPin the xyd CLI version, or change concurrency:
XYD_CLI_VERSION=0.1.0-xyd.197 bun run build
CONCURRENCY=8 bun run build
bun run scripts/build-all.ts --concurrency=8 --only=abtesting,custom-iconsgit -C examples fetch origin
git -C examples checkout origin/main
git add examples
git commit -m "bump examples"Then deploy via the GitHub Actions workflow.
Manual only — go to Actions → deploy → Run workflow and (optionally)
override xyd_cli_version. The default is latest.
Required GitHub secrets:
NETLIFY_AUTH_TOKENNETLIFY_SITE_ID