All files / packages/design-tokens/src/validators theme-parity.js

100% Statements 3/3
100% Branches 0/0
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                                          4x     4x     4x            
#!/usr/bin/env node
 
/**
 * Post-build validator that ensures SLDS and Cosmos themes have identical token keys,
 * preventing missing CSS variables when switching between themes
 *
 * Usage:
 *   yarn validate:parity            # Show summary only
 *   yarn validate:parity --verbose  # Show detailed list of missing tokens
 *   yarn validate:parity --report   # Show full table of all tokens
 *
 * This is the CLI entry point. The core validation logic is in theme-parity-core.js
 * to enable unit testing with mock data.
 */
 
import cosmosTheme from '../../dist/themes/cosmos/cosmos.hooks.flat.json' with { type: 'json' };
import sldsTheme from '../../dist/themes/slds/slds.hooks.flat.json' with { type: 'json' };
import { parseValidatorArgs, loadKnownIssues, exitWithStatus } from './validator-utils.js';
import { validateThemes } from './theme-parity-core.js';
 
// Parse command line arguments
const { isVerbose, isReport } = parseValidatorArgs();
 
// Load known issues
const knownIssues = loadKnownIssues();
 
// Run validation with actual theme data
validateThemes(sldsTheme, cosmosTheme, {
  isVerbose,
  isReport,
  knownIssues,
  exitFn: exitWithStatus,
});