All files / packages/design-system-2/scripts/buildCss args.ts

100% Statements 3/3
100% Branches 2/2
100% Functions 0/0
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                            12x                                                   12x     12x  
/**
 * CLI boundary: argv definitions and parsing for the CSS build.
 *
 * This module reads argv. Consumers import `args` for the parsed flags and
 * `THEME` / `THEME_TOKEN_FOLDER` for the selected theme. It re-exports `THEMES`
 * and `deriveFilename` from utils/names.ts until the builders read them from the
 * config snapshot instead.
 */
 
import arg from 'arg';
 
export { THEMES, deriveFilename } from './utils/names.ts';
 
/** Parsed CLI flags for the CSS build pipeline. */
export const args = arg({
  // Subsystem name. Maps to src/<system>/, for example "slds2".
  '--system': String,
  // Watch mode. Recompiles on source file changes.
  '--watch': Boolean,
  // Dev build. Writes modular standard CSS to build/css/.
  '--dev-standard': Boolean,
  // Dev build. Writes modular theme-layer CSS to build/css/theme-layer/.
  '--dev-theme-layer': Boolean,
  // Production build. Writes every consumer-facing output to dist/css/ and loops all themes.
  '--production': Boolean,
  // Scopes every selector under a wrapper class. The default class is .slds-scope.
  '--scoped': Boolean,
  // Custom scope class name. Only applies with --scoped.
  '--scope-class-name': String,
  // Hooks package folder and file prefix, for example "cosmos" or "lightning-blue".
  '--theme': String,
  // Logs the resolved import order for each build to aid debugging.
  '--debug-imports': Boolean,
});
 
// ─── Selected theme ──────────────────────────────────────────────────────────
 
/** Selected theme. Drives legacy-hooks paths and output filenames. */
// The theme may differ from the design-tokens dist/themes/ folder name, which
// THEME_TOKEN_FOLDER holds.
export const THEME = args['--theme'] || 'cosmos';
 
/** Folder name under design-tokens dist/themes/ that supplies the selected token set. */
export const THEME_TOKEN_FOLDER = THEME;