@@ -51,90 +51,108 @@ export const buildDesignTokens = (buildOptions: ConfigGeneratorOptions): void =>
51
51
/** -----------------------------------
52
52
* Colors, shadows & borders
53
53
* ----------------------------------- */
54
- for ( const { filename, source, include} of themes ) {
55
- // build functional scales
56
- PrimerStyleDictionary . extend (
57
- getStyleDictionaryConfig (
58
- `functional/themes/${ filename } ` ,
59
- source ,
60
- include ,
61
- { ...buildOptions , themed : true } ,
62
- // disable fallbacks for themes
63
- { fallbacks : undefined } ,
64
- ) ,
65
- ) . buildAllPlatforms ( )
54
+ try {
55
+ for ( const { filename, source, include} of themes ) {
56
+ // build functional scales
57
+ PrimerStyleDictionary . extend (
58
+ getStyleDictionaryConfig (
59
+ `functional/themes/${ filename } ` ,
60
+ source ,
61
+ include ,
62
+ { ...buildOptions , themed : true } ,
63
+ // disable fallbacks for themes
64
+ { fallbacks : undefined } ,
65
+ ) ,
66
+ ) . buildAllPlatforms ( )
67
+ }
68
+ } catch ( e ) {
69
+ // eslint-disable-next-line no-console
70
+ console . error ( '🛑 Error trying to build Colors, shadows & borders for code output:' , e )
66
71
}
67
72
68
73
/** -----------------------------------
69
74
* Size tokens
70
75
* ----------------------------------- */
71
- const sizeFiles = glob . sync ( 'src/tokens/functional/size/*' )
72
- //
73
- for ( const file of sizeFiles ) {
76
+ try {
77
+ const sizeFiles = glob . sync ( 'src/tokens/functional/size/*' )
78
+ //
79
+ for ( const file of sizeFiles ) {
80
+ PrimerStyleDictionary . extend (
81
+ getStyleDictionaryConfig (
82
+ `functional/size/${ file . replace ( 'src/tokens/functional/size/' , '' ) . replace ( '.json' , '' ) } ` ,
83
+ [ file ] ,
84
+ [ 'src/tokens/base/size/size.json' , ...sizeFiles ] ,
85
+ buildOptions ,
86
+ ) ,
87
+ ) . buildAllPlatforms ( )
88
+ }
89
+ // build base scales
74
90
PrimerStyleDictionary . extend (
75
- getStyleDictionaryConfig (
76
- `functional/size/${ file . replace ( 'src/tokens/functional/size/' , '' ) . replace ( '.json' , '' ) } ` ,
77
- [ file ] ,
78
- [ 'src/tokens/base/size/size.json' , ...sizeFiles ] ,
79
- buildOptions ,
80
- ) ,
91
+ // using includes as source
92
+ getStyleDictionaryConfig ( `base/size/size` , [ 'src/tokens/base/size/size.json' ] , [ ] , {
93
+ buildPath : buildOptions . buildPath ,
94
+ prefix : undefined ,
95
+ } ) ,
81
96
) . buildAllPlatforms ( )
97
+ } catch ( e ) {
98
+ // eslint-disable-next-line no-console
99
+ console . error ( '🛑 Error trying to build size tokens for code output:' , e )
82
100
}
83
- // build base scales
84
- PrimerStyleDictionary . extend (
85
- // using includes as source
86
- getStyleDictionaryConfig ( `base/size/size` , [ 'src/tokens/base/size/size.json' ] , [ ] , {
87
- buildPath : buildOptions . buildPath ,
88
- prefix : undefined ,
89
- } ) ,
90
- ) . buildAllPlatforms ( )
91
-
92
101
/** -----------------------------------
93
102
* Typography tokens
94
103
* ----------------------------------- */
95
- PrimerStyleDictionary . extend (
96
- getStyleDictionaryConfig (
97
- `functional/typography/typography` ,
98
- [ `src/tokens/functional/typography/*.json` ] ,
99
- [ `src/tokens/base/typography/*.json` ] ,
100
- buildOptions ,
101
- {
102
- css : css ( `css/functional/typography/typography.css` , buildOptions . prefix , buildOptions . buildPath , {
103
- options : {
104
- outputReferences : true ,
105
- } ,
106
- } ) ,
107
- } ,
108
- ) ,
109
- ) . buildAllPlatforms ( )
104
+ try {
105
+ PrimerStyleDictionary . extend (
106
+ getStyleDictionaryConfig (
107
+ `functional/typography/typography` ,
108
+ [ `src/tokens/functional/typography/*.json` ] ,
109
+ [ `src/tokens/base/typography/*.json` ] ,
110
+ buildOptions ,
111
+ {
112
+ css : css ( `css/functional/typography/typography.css` , buildOptions . prefix , buildOptions . buildPath , {
113
+ options : {
114
+ outputReferences : true ,
115
+ } ,
116
+ } ) ,
117
+ } ,
118
+ ) ,
119
+ ) . buildAllPlatforms ( )
110
120
111
- PrimerStyleDictionary . extend (
112
- getStyleDictionaryConfig ( `base/typography/typography` , [ `src/tokens/base/typography/*.json` ] , [ ] , buildOptions ) ,
113
- ) . buildAllPlatforms ( )
121
+ PrimerStyleDictionary . extend (
122
+ getStyleDictionaryConfig ( `base/typography/typography` , [ `src/tokens/base/typography/*.json` ] , [ ] , buildOptions ) ,
123
+ ) . buildAllPlatforms ( )
124
+ } catch ( e ) {
125
+ // eslint-disable-next-line no-console
126
+ console . error ( '🛑 Error trying to build typography tokens for code output:' , e )
127
+ }
114
128
115
129
/** -----------------------------------
116
130
* Motion tokens
117
131
* ----------------------------------- */
118
- PrimerStyleDictionary . extend (
119
- getStyleDictionaryConfig (
120
- `functional/motion/motion` ,
121
- [ `src/tokens/functional/motion/*.json5` ] ,
122
- [ `src/tokens/base/motion/*.json5` ] ,
123
- buildOptions ,
124
- {
125
- css : css ( `css/functional/motion/motion.css` , buildOptions . prefix , buildOptions . buildPath , {
126
- options : {
127
- outputReferences : true ,
128
- } ,
129
- } ) ,
130
- } ,
131
- ) ,
132
- ) . buildAllPlatforms ( )
133
-
134
- PrimerStyleDictionary . extend (
135
- getStyleDictionaryConfig ( `base/motion/motion` , [ `src/tokens/base/motion/*.json5` ] , [ ] , buildOptions ) ,
136
- ) . buildAllPlatforms ( )
132
+ try {
133
+ PrimerStyleDictionary . extend (
134
+ getStyleDictionaryConfig (
135
+ `functional/motion/motion` ,
136
+ [ `src/tokens/functional/motion/*.json5` ] ,
137
+ [ `src/tokens/base/motion/*.json5` ] ,
138
+ buildOptions ,
139
+ {
140
+ css : css ( `css/functional/motion/motion.css` , buildOptions . prefix , buildOptions . buildPath , {
141
+ options : {
142
+ outputReferences : true ,
143
+ } ,
144
+ } ) ,
145
+ } ,
146
+ ) ,
147
+ ) . buildAllPlatforms ( )
137
148
149
+ PrimerStyleDictionary . extend (
150
+ getStyleDictionaryConfig ( `base/motion/motion` , [ `src/tokens/base/motion/*.json5` ] , [ ] , buildOptions ) ,
151
+ ) . buildAllPlatforms ( )
152
+ } catch ( e ) {
153
+ // eslint-disable-next-line no-console
154
+ console . error ( '🛑 Error trying to build motion tokens for code output:' , e )
155
+ }
138
156
/** -----------------------------------
139
157
* deprecated tokens
140
158
* ----------------------------------- */
@@ -144,6 +162,7 @@ export const buildDesignTokens = (buildOptions: ConfigGeneratorOptions): void =>
144
162
filename : 'theme' ,
145
163
source : [
146
164
`src/tokens/base/color/light/light.json5` ,
165
+ `src/tokens/base/color/light/display-light.json5` ,
147
166
`src/tokens/functional/color/light/*.json5` ,
148
167
`src/tokens/functional/shadow/light.json5` ,
149
168
`src/tokens/functional/border/light.json5` ,
@@ -170,16 +189,20 @@ export const buildDesignTokens = (buildOptions: ConfigGeneratorOptions): void =>
170
189
} ,
171
190
]
172
191
//
173
- for ( const { filename, source, include} of deprecatedBuilds ) {
174
- PrimerStyleDictionary . extend ( {
175
- source,
176
- include,
177
- platforms : {
178
- deprecated : deprecatedJson ( `deprecated/${ filename } .json` , buildOptions . prefix , buildOptions . buildPath ) ,
179
- } ,
180
- } ) . buildAllPlatforms ( )
192
+ try {
193
+ for ( const { filename, source, include} of deprecatedBuilds ) {
194
+ PrimerStyleDictionary . extend ( {
195
+ source,
196
+ include,
197
+ platforms : {
198
+ deprecated : deprecatedJson ( `deprecated/${ filename } .json` , buildOptions . prefix , buildOptions . buildPath ) ,
199
+ } ,
200
+ } ) . buildAllPlatforms ( )
201
+ }
202
+ } catch ( e ) {
203
+ // eslint-disable-next-line no-console
204
+ console . error ( '🛑 Error trying to build deprecated tokens output:' , e )
181
205
}
182
-
183
206
/** -----------------------------------
184
207
* Copy `removed` files
185
208
* ----------------------------------- */
0 commit comments