Skip to content

Commit

Permalink
docgen: Generate package docs in parallel (#14295)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored and youknowriad committed Mar 20, 2019
1 parent 74b0f29 commit 53dd02b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bin/update-readmes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env node

const path = require( 'path' );
const childProcess = require( 'child_process' );
const { promisify } = require( 'util' );
const spawn = promisify( require( 'child_process' ).spawn );

const packages = [
'a11y',
Expand Down Expand Up @@ -53,19 +54,18 @@ const getArgsForPackage = ( packageName ) => {
}
};

let aggregatedExitCode = 0;
packages.forEach( ( packageName ) => {
Promise.all( packages.map( async ( packageName ) => {
const args = getArgsForPackage( packageName );
const pathToDocGen = path.join( __dirname, '..', 'node_modules', '.bin', 'docgen' );
const { status, stderr } = childProcess.spawnSync(
const { status, stderr } = await spawn(
pathToDocGen,
args,
{ shell: true },
);
if ( status !== 0 ) {
aggregatedExitCode = status;
process.stderr.write( `${ stderr }\n` );
throw stderr.toString();
}
} ) ).catch( ( error ) => {
process.stderr.write( `${ error }\n` );
process.exit( 1 );
} );

process.exit( aggregatedExitCode );

0 comments on commit 53dd02b

Please sign in to comment.