From 6287a8ca656d33ee5d228cc9ed3bacf4204194fe Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Thu, 13 Jul 2023 15:51:50 -0500 Subject: [PATCH] Fix whitespace not matching in `since` command. This fixes an issue where the since command was failing to replace instances of `n.e.x.t` when more than once space occurred between the `@since` and the placeholder version number, e.g., for docblock alignment purposes. --- bin/plugin/commands/since.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/plugin/commands/since.js b/bin/plugin/commands/since.js index af6b34b412..8319888d29 100644 --- a/bin/plugin/commands/since.js +++ b/bin/plugin/commands/since.js @@ -47,13 +47,14 @@ exports.handler = async ( opt ) => { ignore: [ __filename, '**/node_modules', '**/vendor' ], } ); - const regexp = new RegExp( '@since n.e.x.t', 'g' ); + const regexp = new RegExp( '@since(\\s+)n.e.x.t', 'g' ); + files.forEach( ( file ) => { const content = fs.readFileSync( file, 'utf-8' ); if ( regexp.test( content ) ) { fs.writeFileSync( file, - content.replace( regexp, `@since ${ opt.release }` ) + content.replace( regexp, `@since$1${ opt.release }` ) ); } } );