Build CLI
Generates static artifacts (CSS / JSON / TS) from apollion.config.mjs
(or .json). Atomic and idempotent build: two runs with the same
config + env produce a byte-identical dist/.
Installation
yarn add -D @apollion-dsi/tokensBin: apollion-tokens (also via yarn dlx).
Usage
apollion-tokens build --config apollion.config.mjs --out dist/tokens
apollion-tokens build --check --config apollion.config.mjs --out dist/tokens
apollion-tokens build --verbose --config apollion.config.mjs --out dist/tokens| Flag | Default | Role |
|---|---|---|
--config | apollion.config.mjs | Config path (.mjs / .js / .json) |
--out | dist | Output directory |
--check | off | CI gate — exit 1 if manifest.json drift |
--verbose | off | Log per emitted file |
Exit codes
| Code | Meaning |
|---|---|
0 | OK (build wrote, or --check with no drift) |
1 | Build error, or drift on --check |
2 | Invalid args |
Config (apollion.config.mjs)
import { defineConfig } from '@apollion-dsi/tokens/config-loader';
export default defineConfig({
brands: {
default: {
baseDark: '#26292E',
baseLight: '#FCFCFC',
deepDark: '#000',
deepLight: '#FFF',
main: '#003750',
complementary: '#F6BA20',
primary: '#32AFDC',
secondary: '#2D81AA',
tertiary: '#2CE571',
success: '#2CB567',
warning: '#F6BA20',
danger: '#E12712',
information: '#3399FF',
},
},
modes: ['light', 'dark'],
surfaces: ['positive', 'negative'],
dimensions: ['compact', 'normal', 'spacious'],
output: { css: true, json: true, ts: true },
});.json also works (fixtures / simple CI). .mjs / .js go through the
sandboxed loader (node:vm + zod) — require() / dynamic import()
rejected before evaluation.
Variant matrix
Each cell of the cartesian product:
brand × mode × surface × dimensionbecomes a basename:
<brand>.<mode>.<surface>.<dimension>E.g.: default.light.positive.normal.
Defaults when omitted: modes light|dark, surfaces positive|negative,
dimensions compact|normal|spacious → 12 variants per brand.
Output flags
| Flag | Emits |
|---|---|
output.css | dist/css/<variant>.css |
output.json | dist/json/ (resolver + sets — see Output) |
output.ts | dist/ts/<variant>.d.ts |
output.designMd | dist/design/<brand>.design.md (AI context with resolved values) |
output.tailwind | dist/tailwind/{preset,tw-merge}.mjs + -rgb companions in dist/css/ |
output.runtime | ESM/CJS runtime for core's dynamic-import |
Everything defaults to false: without opt-in, zero artifacts in the consumer's dist/.
See also
- Overview
- Output (CSS / JSON / TS)
- Brand examples
- Create Theme —
createThemevs Config-First