1- import type { Config } from 'style-dictionary/types'
1+ import type { Config , LogConfig } from 'style-dictionary/types'
22import { PrimerStyleDictionary } from '../src/primerStyleDictionary.js'
33import { copyFromDir } from '../src/utilities/index.js'
44import { deprecatedJson , css , docJson , fallbacks , styleLint } from '../src/platforms/index.js'
@@ -12,6 +12,14 @@ import {themes} from './themes.config.js'
1212import fs from 'fs'
1313import { getFallbackTheme } from './utilities/getFallbackTheme.js'
1414
15+ const log : LogConfig = {
16+ warnings : 'disabled' , // 'warn' | 'error' | 'disabled'
17+ verbosity : 'silent' , // 'default' | 'silent' | 'verbose'
18+ errors : {
19+ brokenReferences : 'throw' , // 'throw' | 'console'
20+ } ,
21+ }
22+
1523/**
1624 * getStyleDictionaryConfig
1725 * @param filename output file name without extension
@@ -29,21 +37,15 @@ const getStyleDictionaryConfig: StyleDictionaryConfigGenerator = (
2937) : Config => ( {
3038 source, // build the special formats
3139 include,
32- log : {
33- warnings : 'disabled' , // 'warn' | 'error' | 'disabled'
34- verbosity : 'silent' , // 'default' | 'silent' | 'verbose'
35- errors : {
36- brokenReferences : 'throw' , // 'throw' | 'console'
37- } ,
38- } ,
40+ log,
3941 platforms : Object . fromEntries (
4042 Object . entries ( {
4143 css : css ( `css/${ filename } .css` , options . prefix , options . buildPath , {
4244 themed : options . themed ,
43- theme : options . theme ,
45+ theme : [ options . theme , getFallbackTheme ( options . theme ) ] ,
4446 } ) ,
4547 docJson : docJson ( `docs/${ filename } .json` , options . prefix , options . buildPath , {
46- theme : options . theme ,
48+ theme : [ options . theme , getFallbackTheme ( options . theme ) ] ,
4749 } ) ,
4850 styleLint : styleLint ( `styleLint/${ filename } .json` , options . prefix , options . buildPath , {
4951 theme : options . theme ,
@@ -58,25 +60,26 @@ export const buildDesignTokens = async (buildOptions: ConfigGeneratorOptions): P
5860 /** -----------------------------------
5961 * Internal Colors
6062 * ----------------------------------- */
61- try {
62- for ( const { filename, source, include, theme} of themes ) {
63- // build functional scales
64- const extendedSD = await PrimerStyleDictionary . extend ( {
65- source : [ ...source , ...include ] , // build the special formats
66- include,
67- platforms : {
68- css : css ( `internalCss/${ filename } .css` , buildOptions . prefix , buildOptions . buildPath , {
69- themed : true ,
70- theme : [ theme , getFallbackTheme ( theme ) ] ,
71- } ) ,
72- } ,
73- } )
74- await extendedSD . buildAllPlatforms ( )
75- }
76- } catch ( e ) {
77- // eslint-disable-next-line no-console
78- console . error ( '🛑 Error trying to build internal css colors for code output:' , e )
79- }
63+ // try {
64+ // for (const {filename, source, include, theme} of themes) {
65+ // // build functional scales
66+ // const extendedSD = await PrimerStyleDictionary.extend({
67+ // source: [...source, ...include], // build the special formats
68+ // include,
69+ // log,
70+ // platforms: {
71+ // css: css(`internalCss/${filename}.css`, buildOptions.prefix, buildOptions.buildPath, {
72+ // themed: true,
73+ // theme: [theme, getFallbackTheme(theme)],
74+ // }),
75+ // },
76+ // })
77+ // await extendedSD.buildAllPlatforms()
78+ // }
79+ // } catch (e) {
80+ // // eslint-disable-next-line no-console
81+ // console.error('🛑 Error trying to build internal css colors for code output:', e)
82+ // }
8083
8184 /** -----------------------------------
8285 * Colors, shadows & borders
0 commit comments