All files / packages/sds-styling-hooks/scripts build.js

0% Statements 0/8
100% Branches 0/0
0% Functions 0/1
0% Lines 0/8

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                                                                                       
import path from 'node:path';
import { fileURLToPath } from 'url';
import { globSync } from 'glob';
import StylingHooks from '../src/index.js';
 
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const root = path.resolve(__dirname, '../');
 
/**
 * Here we generate the SDS defaults
 */
new StylingHooks({
  rootDir: path.resolve(root, 'src/props/'),
  outputDir: path.resolve(root, 'dist/'),
  default: true,
}).generateDefaults();
 
/**
 * Here we generate the Design System version
 * and other required configurations
 */
new StylingHooks({
  rootDir: path.resolve(root, 'src/config/'),
  outputDir: path.resolve(root, 'dist/'),
}).generateHooksConfig();
 
/**
 * Here we generate the themes and shared props
 * located in src/themes
 */
globSync(path.resolve(root, 'src/themes/*')).forEach((dir) => {
  const theme = path.parse(dir).name;
  new StylingHooks({
    rootDir: path.resolve(root, 'src/props/'),
    themesDir: path.resolve(root, 'src/themes/'),
    outputDir: path.resolve(root, 'dist/'),
    themes: theme,
    shared: true,
    component: true,
    deprecated: true,
  }).generateTheme(theme);
});