@@ -108,27 +108,29 @@ async function fetchFile(name) {
108108async function main ( ) {
109109 console . log ( "sync-tagotip: fetching specs from GitHub..." ) ;
110110
111- for ( const file of FILES ) {
112- const outPath = join ( ROOT , file . out ) ;
113- try {
114- const raw = await fetchFile ( file . remote ) ;
115- const stripped = stripLicenseHeader ( raw ) ;
116- const escaped = escapeBraces ( stripped ) ;
117- const rewritten = rewriteLinks ( escaped ) ;
118- const content = `${ file . frontmatter } \n\n${ rewritten } ` ;
111+ await Promise . all (
112+ FILES . map ( async ( file ) => {
113+ const outPath = join ( ROOT , file . out ) ;
114+ try {
115+ const raw = await fetchFile ( file . remote ) ;
116+ const stripped = stripLicenseHeader ( raw ) ;
117+ const escaped = escapeBraces ( stripped ) ;
118+ const rewritten = rewriteLinks ( escaped ) ;
119+ const content = `${ file . frontmatter } \n\n${ rewritten } ` ;
119120
120- mkdirSync ( dirname ( outPath ) , { recursive : true } ) ;
121- writeFileSync ( outPath , content ) ;
122- console . log ( ` Wrote ${ file . out } ` ) ;
123- } catch ( err ) {
124- if ( existsSync ( outPath ) ) {
125- console . warn ( ` Warning: failed to fetch ${ file . remote } (${ err . message } ), using existing file` ) ;
126- } else {
127- console . error ( ` Error: failed to fetch ${ file . remote } and no cached file exists` ) ;
128- process . exit ( 1 ) ;
121+ mkdirSync ( dirname ( outPath ) , { recursive : true } ) ;
122+ writeFileSync ( outPath , content ) ;
123+ console . log ( ` Wrote ${ file . out } ` ) ;
124+ } catch ( err ) {
125+ if ( existsSync ( outPath ) ) {
126+ console . warn ( ` Warning: failed to fetch ${ file . remote } (${ err . message } ), using existing file` ) ;
127+ } else {
128+ console . error ( ` Error: failed to fetch ${ file . remote } and no cached file exists` ) ;
129+ process . exit ( 1 ) ;
130+ }
129131 }
130- }
131- }
132+ } )
133+ ) ;
132134
133135 console . log ( "sync-tagotip: done." ) ;
134136}
0 commit comments