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