Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
# Full history so check-token-registry.js can diff the registry
# against the base branch (id-permanence gate) rather than HEAD.
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
Expand All @@ -88,6 +91,7 @@ jobs:
- run: npm run audit:check
- run: node scripts/check-artifacts.js --check
- run: node scripts/check-version-sync.js
- run: node scripts/check-token-registry.js

dependency-audit:
name: Dependency vulnerability audit
Expand Down
4 changes: 1 addition & 3 deletions configurator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions configurator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"pretest:e2e": "npm run build",
"test:e2e": "playwright test"
},
"dependencies": {
"lz-string": "^1.5.0"
},
"devDependencies": {
"@axe-core/playwright": "^4.11.3",
"@playwright/test": "^1.60.0",
Expand Down
39 changes: 39 additions & 0 deletions configurator/scripts/sync-api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ const SOURCE =

const ANNOTATIONS_FILE = path.join(FRAMEWORK_ROOT, 'docs', 'token-annotations.json');
const BUNDLE_CONFIG_FILE = path.join(FRAMEWORK_ROOT, 'bundle.config.json');
const REGISTRY_FILE = path.join(FRAMEWORK_ROOT, 'token-registry.json');

const OUT_DIR = path.join(CONFIGURATOR_ROOT, 'src', 'data');
const OUT = path.join(OUT_DIR, 'api-index.generated.json');
const BUNDLES_OUT = path.join(OUT_DIR, 'bundles.generated.json');
const REGISTRY_OUT = path.join(OUT_DIR, 'token-registry.generated.json');

// jsDelivr serves the published dist branch (see .github/workflows/publish-dist.yml)
// at the repo root, so a bundle's minified file is <CDN_BASE>/slashed.<id>.min.css.
Expand Down Expand Up @@ -272,6 +274,43 @@ function main() {
`[configurator:sync] ${path.relative(FRAMEWORK_ROOT, BUNDLES_OUT)} ← ` +
`${bundlesOut._sync.source} (${manifest.bundles.length} bundles)`
);

// Token id registry for the shareable config codec (src/lib/codec.js). Copied
// verbatim so the configurator imports it the same way model.js imports the
// api-index — and so the runtime can never drift from the committed registry.
syncRegistry();
}

/**
* Copy token-registry.json → src/data/token-registry.generated.json. The
* registry is the canonical, append-only id map maintained by
* scripts/gen-token-registry.js; this is just a build-time mirror.
*/
function syncRegistry() {
if (!fs.existsSync(REGISTRY_FILE)) {
console.error(
`[configurator:sync] token-registry.json not found at ${REGISTRY_FILE}\n` +
`Run \`npm run gen:registry\` in the framework root first.`
);
process.exit(1);
}
let registry;
try {
registry = JSON.parse(fs.readFileSync(REGISTRY_FILE, 'utf8'));
} catch (err) {
console.error(`[configurator:sync] ${REGISTRY_FILE} is not valid JSON (${err.message}).`);
process.exit(1);
}
const tokenCount = Array.isArray(registry.tokens) ? registry.tokens.length : 0;
if (tokenCount === 0) {
console.error(`[configurator:sync] token-registry.json has no tokens — refusing to write an empty registry.`);
process.exit(1);
}
fs.writeFileSync(REGISTRY_OUT, JSON.stringify(registry, null, 2) + '\n', 'utf8');
console.log(
`[configurator:sync] ${path.relative(FRAMEWORK_ROOT, REGISTRY_OUT)} ← ` +
`token-registry.json (${tokenCount} ids)`
);
}

main();
Loading