1
- import type { Config } from 'style-dictionary/types'
1
+ import type { Config , LogConfig } from 'style-dictionary/types'
2
2
import { PrimerStyleDictionary } from '../src/primerStyleDictionary.js'
3
3
import { copyFromDir } from '../src/utilities/index.js'
4
4
import { deprecatedJson , css , docJson , fallbacks , styleLint } from '../src/platforms/index.js'
@@ -12,6 +12,14 @@ import {themes} from './themes.config.js'
12
12
import fs from 'fs'
13
13
import { getFallbackTheme } from './utilities/getFallbackTheme.js'
14
14
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
+
15
23
/**
16
24
* getStyleDictionaryConfig
17
25
* @param filename output file name without extension
@@ -29,21 +37,15 @@ const getStyleDictionaryConfig: StyleDictionaryConfigGenerator = (
29
37
) : Config => ( {
30
38
source, // build the special formats
31
39
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,
39
41
platforms : Object . fromEntries (
40
42
Object . entries ( {
41
43
css : css ( `css/${ filename } .css` , options . prefix , options . buildPath , {
42
44
themed : options . themed ,
43
- theme : options . theme ,
45
+ theme : [ options . theme , getFallbackTheme ( options . theme ) ] ,
44
46
} ) ,
45
47
docJson : docJson ( `docs/${ filename } .json` , options . prefix , options . buildPath , {
46
- theme : options . theme ,
48
+ theme : [ options . theme , getFallbackTheme ( options . theme ) ] ,
47
49
} ) ,
48
50
styleLint : styleLint ( `styleLint/${ filename } .json` , options . prefix , options . buildPath , {
49
51
theme : options . theme ,
@@ -58,25 +60,26 @@ export const buildDesignTokens = async (buildOptions: ConfigGeneratorOptions): P
58
60
/** -----------------------------------
59
61
* Internal Colors
60
62
* ----------------------------------- */
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
+ // }
80
83
81
84
/** -----------------------------------
82
85
* Colors, shadows & borders
0 commit comments