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 2233
44# (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)
66# This access token is necessary to fetch the json from zeplin
77DEVELOPER_ZEPLIN_ACCESS_TOKEN = TODO
Original file line number Diff line number Diff line change 55 "import/extensions" : 0 ,
66 "max-depth" : 0 ,
77 "n/prefer-global/process" : 0 ,
8- "max-params" : 0 ,
9- "unicorn/prefer-top-level-await" : 0
8+ "max-params" : 0
109 }
1110}
Original file line number Diff line number Diff line change 3333 "pl:install" : " patternlab install --config ./patternlab-config.json" ,
3434 "pl:serve" : " patternlab serve --config ./patternlab-config.json" ,
3535 "pl:version" : " patternlab --version" ,
36- "zeplin:tokens" : " node scripts/zeplin-styleguide.js "
36+ "zeplin:tokens" : " node scripts/zeplin-styleguide.mjs "
3737 },
3838 "license" : " Apache-2.0" ,
3939 "dependencies" : {
Original file line number Diff line number Diff line change 55import * as process from 'node:process' ;
66import * as fs from 'node:fs' ;
77
8- const run = async ( ) => {
9- const defaultConfig = process . argv [ 2 ] ;
8+ const defaultConfig = process . argv [ 2 ] ;
109
11- const internal = process . argv [ 3 ] ;
10+ const internal = process . argv [ 3 ] ;
1211
13- let configFile = `
12+ let configFile = `
1413 const tokens = require('${
1514 internal ? './' : '@db-ui/base/build/tailwind/'
1615 } tailwind-tokens.json')
@@ -31,14 +30,11 @@ const run = async () => {
3130 };
3231 ` ;
3332
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+ }
3736
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 ( ) ;
46
57const zeplin = new ZeplinApi (
68 new Configuration ( {
@@ -191,26 +193,24 @@ const convertSpacings = (data) => {
191193 data . spacing = mergeData ( spacings ) ;
192194} ;
193195
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+ ) ;
199200
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