@@ -8,31 +8,33 @@ const {
8
8
namePrefix,
9
9
} = require ( `${ basePath } /src/config.js` ) ;
10
10
11
- // read json data
12
- let rawdata = fs . readFileSync ( `${ basePath } /build/json/_metadata.json` ) ;
13
- let data = JSON . parse ( rawdata ) ;
11
+ ( async ( ) => {
12
+ // read json data
13
+ let rawdata = fs . readFileSync ( `${ basePath } /build/json/_metadata.json` ) ;
14
+ let data = JSON . parse ( rawdata ) ;
14
15
15
- console . log ( "Info will be updated using the config.js data." ) ;
16
- const updateName = await yesno ( `Update names?` ) ;
17
- const updateDescription = await yesno ( `Update descriptions?` ) ;
18
- const updateBaseUri = await yesno ( `Update images base URI?` ) ;
16
+ console . log ( "Info will be updated using the config.js data." ) ;
17
+ const updateName = await yesno ( `Update names?` ) ;
18
+ const updateDescription = await yesno ( `Update descriptions?` ) ;
19
+ const updateBaseUri = await yesno ( `Update images base URI?` ) ;
20
+
21
+ data . forEach ( ( item ) => {
22
+ if ( updateName ) item . name = `${ namePrefix } #${ item . edition } ` ;
23
+ if ( updateDescription ) item . description = description ;
24
+ if ( updateBaseUri ) item . image = `${ baseUri } /${ item . edition } .png` ;
25
+
26
+ fs . writeFileSync (
27
+ `${ basePath } /build/json/${ item . edition } .json` ,
28
+ JSON . stringify ( item , null , 2 )
29
+ ) ;
30
+ } ) ;
19
31
20
- data . forEach ( ( item ) => {
21
- if ( updateName ) item . name = `${ namePrefix } #${ item . edition } ` ;
22
- if ( updateDescription ) item . description = description ;
23
- if ( updateBaseUri ) item . image = `${ baseUri } /${ item . edition } .png` ;
24
-
25
32
fs . writeFileSync (
26
- `${ basePath } /build/json/${ item . edition } .json` ,
27
- JSON . stringify ( item , null , 2 )
33
+ `${ basePath } /build/json/_metadata .json` ,
34
+ JSON . stringify ( data , null , 2 )
28
35
) ;
29
- } ) ;
30
-
31
- fs . writeFileSync (
32
- `${ basePath } /build/json/_metadata.json` ,
33
- JSON . stringify ( data , null , 2 )
34
- ) ;
35
36
36
- if ( updateName ) console . log ( `Updated name prefix for images to ===> ${ namePrefix } ` ) ;
37
- if ( updateBaseUri ) console . log ( `Updated baseUri for images to ===> ${ baseUri } ` ) ;
38
- if ( updateDescription ) console . log ( `Updated description for images to ===> ${ description } ` ) ;
37
+ if ( updateName ) console . log ( `Updated name prefix for images to ===> ${ namePrefix } ` ) ;
38
+ if ( updateBaseUri ) console . log ( `Updated baseUri for images to ===> ${ baseUri } ` ) ;
39
+ if ( updateDescription ) console . log ( `Updated description for images to ===> ${ description } ` ) ;
40
+ } ) ( )
0 commit comments