From c536382b6ea970ebcbf733200b54e23679044ccb Mon Sep 17 00:00:00 2001 From: Mustaque Ahmed Date: Wed, 1 Jun 2022 17:03:34 +0530 Subject: [PATCH] Scripts: plugin-zip to include root path files (#41439) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * initial commit * add condition to not add `.` in the path of root files * Update CHANGELOG.md Co-authored-by: Greg Ziółkowski --- packages/scripts/CHANGELOG.md | 4 ++++ packages/scripts/scripts/plugin-zip.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 177a8ff6a09eb..1320dc10ec253 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fix + +- Fix incorrect handling in `plugin-zip` for root-level files and some specific platform conditions ([#41439](https://github.com/WordPress/gutenberg/pull/41439)). + ## 23.1.0 (2022-05-18) ### New Feature diff --git a/packages/scripts/scripts/plugin-zip.js b/packages/scripts/scripts/plugin-zip.js index 4bc66e50fa56c..b7c2a4df485c2 100644 --- a/packages/scripts/scripts/plugin-zip.js +++ b/packages/scripts/scripts/plugin-zip.js @@ -49,7 +49,8 @@ if ( hasPackageProp( 'files' ) ) { files.forEach( ( file ) => { stdout.write( ` Adding \`${ file }\`.\n` ); - zip.addLocalFile( file, dirname( file ) ); + const zipDirectory = dirname( file ); + zip.addLocalFile( file, zipDirectory !== '.' ? zipDirectory : '' ); } ); zip.writeZip( `./${ name }.zip` );