From 3958615ab937d7f8d08010ea19c03fc354465513 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Wed, 4 Dec 2019 16:52:10 -0500 Subject: [PATCH] docgen: Move packageName assignment outside loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Andrés --- bin/update-readmes.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/update-readmes.js b/bin/update-readmes.js index 05927691a8e6f2..3833259555d096 100755 --- a/bin/update-readmes.js +++ b/bin/update-readmes.js @@ -111,12 +111,13 @@ glob.stream( `${ PACKAGES_DIR }/${ getPackagePattern( files ) }/README.md` ) .on( 'data', async ( /** @type {WPReadmeFileData} */ data ) => { const [ file, tokens ] = data; + const packageName = getFilePackage( file ); + // Each file can have more than one placeholder content to update, each // represented by tokens. The docgen script updates one token at a time, // so the tokens must be replaced in sequence to prevent the processes // from overriding each other. for ( const [ token, path ] of tokens ) { - const packageName = getFilePackage( file ); try { await execa( join( __dirname, '..', 'node_modules', '.bin', 'docgen' ),