File tree Expand file tree Collapse file tree 5 files changed +38
-43
lines changed Expand file tree Collapse file tree 5 files changed +38
-43
lines changed Original file line number Diff line number Diff line change 2
2
COMMIT_MAIL=my.commit@mail.com
3
3
4
4
# (https://app.zeplin.io/profile/developer)
5
- # (https://github.com/db-ui/base/blob/feat-zeplin-token-generation/scripts/zeplin-styleguide.js #L7)
5
+ # (https://github.com/db-ui/base/blob/feat-zeplin-token-generation/scripts/zeplin-styleguide.mjs #L7)
6
6
# This access token is necessary to fetch the json from zeplin
7
7
DEVELOPER_ZEPLIN_ACCESS_TOKEN=TODO
Original file line number Diff line number Diff line change 5
5
"import/extensions" : 0 ,
6
6
"max-depth" : 0 ,
7
7
"n/prefer-global/process" : 0 ,
8
- "max-params" : 0 ,
9
- "unicorn/prefer-top-level-await" : 0
8
+ "max-params" : 0
10
9
}
11
10
}
Original file line number Diff line number Diff line change 33
33
"pl:install" : " patternlab install --config ./patternlab-config.json" ,
34
34
"pl:serve" : " patternlab serve --config ./patternlab-config.json" ,
35
35
"pl:version" : " patternlab --version" ,
36
- "zeplin:tokens" : " node scripts/zeplin-styleguide.js "
36
+ "zeplin:tokens" : " node scripts/zeplin-styleguide.mjs "
37
37
},
38
38
"license" : " Apache-2.0" ,
39
39
"dependencies" : {
Original file line number Diff line number Diff line change 5
5
import * as process from 'node:process' ;
6
6
import * as fs from 'node:fs' ;
7
7
8
- const run = async ( ) => {
9
- const defaultConfig = process . argv [ 2 ] ;
8
+ const defaultConfig = process . argv [ 2 ] ;
10
9
11
- const internal = process . argv [ 3 ] ;
10
+ const internal = process . argv [ 3 ] ;
12
11
13
- let configFile = `
12
+ let configFile = `
14
13
const tokens = require('${
15
14
internal ? './' : '@db-ui/base/build/tailwind/'
16
15
} tailwind-tokens.json')
@@ -31,14 +30,11 @@ const run = async () => {
31
30
};
32
31
` ;
33
32
34
- if ( defaultConfig === 'default' ) {
35
- configFile = `module.exports = require('@db-ui/base/build/tailwind/tailwind.config')` ;
36
- }
33
+ if ( defaultConfig === 'default' ) {
34
+ configFile = `module.exports = require('@db-ui/base/build/tailwind/tailwind.config')` ;
35
+ }
37
36
38
- fs . writeFileSync (
39
- `${ internal ? './build/tailwind' : '.' } /tailwind.config.js` ,
40
- configFile
41
- ) ;
42
- } ;
43
-
44
- run ( ) ;
37
+ await fs . writeFileSync (
38
+ `${ internal ? './build/tailwind' : '.' } /tailwind.config.js` ,
39
+ configFile
40
+ ) ;
Original file line number Diff line number Diff line change 1
- require ( 'dotenv' ) . config ( ) ;
2
- const FS = require ( 'node:fs' ) ;
3
- const { ZeplinApi, Configuration } = require ( '@zeplin/sdk' ) ;
1
+ import * as fs from 'node:fs' ;
2
+ import * as dotenv from 'dotenv' ; // See https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
3
+ import { ZeplinApi , Configuration } from '@zeplin/sdk' ;
4
+
5
+ dotenv . config ( ) ;
4
6
5
7
const zeplin = new ZeplinApi (
6
8
new Configuration ( {
@@ -191,26 +193,24 @@ const convertSpacings = (data) => {
191
193
data . spacing = mergeData ( spacings ) ;
192
194
} ;
193
195
194
- ( async ( ) => {
195
- try {
196
- const { data } = await zeplin . designTokens . getStyleguideDesignTokens (
197
- '63037ab49bdcb913c9228718'
198
- ) ;
196
+ try {
197
+ const { data } = await zeplin . designTokens . getStyleguideDesignTokens (
198
+ '63037ab49bdcb913c9228718'
199
+ ) ;
199
200
200
- convertColors ( data ) ;
201
- convertTextStyles ( data ) ;
202
- convertSpacings ( data ) ;
203
-
204
- FS . writeFileSync (
205
- './tokens/zeplin.json' ,
206
- JSON . stringify ( {
207
- spacing : data . spacing ,
208
- sizing : data . sizing ,
209
- typography : data . textStyles ,
210
- colors : data . colors
211
- } )
212
- ) ;
213
- } catch ( error ) {
214
- console . error ( error ) ;
215
- }
216
- } ) ( ) ;
201
+ convertColors ( data ) ;
202
+ convertTextStyles ( data ) ;
203
+ convertSpacings ( data ) ;
204
+
205
+ fs . writeFileSync (
206
+ './tokens/zeplin.json' ,
207
+ JSON . stringify ( {
208
+ spacing : data . spacing ,
209
+ sizing : data . sizing ,
210
+ typography : data . textStyles ,
211
+ colors : data . colors
212
+ } )
213
+ ) ;
214
+ } catch ( error ) {
215
+ console . error ( error ) ;
216
+ }
You can’t perform that action at this time.
0 commit comments