@@ -86,19 +86,22 @@ function replaceInFile(filePath, replacements) {
8686}
8787
8888function createZip ( sourceDir , outputPath ) {
89- try {
90- // Try using built-in zip command (available on most systems)
91- if ( process . platform === 'win32' ) {
92- // Use PowerShell on Windows
93- execSync ( `powershell -Command "Compress-Archive -Path '${ sourceDir } /*' -DestinationPath '${ outputPath } ' -Force"` , { stdio : 'inherit' } ) ;
94- } else {
95- // Use zip command on Unix-like systems
96- execSync ( `cd "${ sourceDir } " && zip -r "../${ path . basename ( outputPath ) } " . -x "*.DS_Store"` , { stdio : 'inherit' } ) ;
97- }
98- } catch ( error ) {
99- log ( `Warning: Could not create zip file ${ outputPath } . Please install zip utility.` , colors . yellow ) ;
100- log ( `You can manually zip the contents of ${ sourceDir } ` , colors . yellow ) ;
89+ try {
90+ // Try using built-in zip command (available on most systems)
91+ if ( process . platform === 'win32' ) {
92+ // Use PowerShell on Windows
93+ execSync ( `powershell -Command "Compress-Archive -Path '${ sourceDir } /*' -DestinationPath '${ outputPath } ' -Force"` , { stdio : 'inherit' } ) ;
94+ } else {
95+ // Use zip command on Unix-like systems
96+ // Always write ZIP to repository root to match CI checks and Windows behavior
97+ execSync ( `zip -r "${ outputPath } " "${ sourceDir } " -x "*.DS_Store"` , { stdio : 'inherit' } ) ;
10198 }
99+ } catch ( error ) {
100+ log ( `Warning: Could not create zip file ${ outputPath } . Please install zip utility.` , colors . yellow ) ;
101+ log ( `You can manually zip the contents of ${ sourceDir } ` , colors . yellow ) ;
102+ // Rethrow to fail the build so CI can catch the real issue
103+ throw new Error ( `Failed to create ZIP: ${ outputPath } . Root cause: ${ error . message } ` ) ;
104+ }
102105}
103106
104107function cleanBuild ( ) {
@@ -287,14 +290,23 @@ function createPackages(target) {
287290
288291 if ( target === 'all' || target === 'chrome' ) {
289292 createZip ( path . join ( BUILD_DIR , 'chrome' ) , `${ EXTENSION_NAME } .zip` ) ;
293+ if ( ! fs . existsSync ( `${ EXTENSION_NAME } .zip` ) ) {
294+ throw new Error ( `Expected ZIP not found: ${ EXTENSION_NAME } .zip` ) ;
295+ }
290296 }
291297
292298 if ( target === 'all' || target === 'firefox' ) {
293299 createZip ( path . join ( BUILD_DIR , 'firefox' ) , `${ FIREFOX_EXTENSION_NAME } .zip` ) ;
300+ if ( ! fs . existsSync ( `${ FIREFOX_EXTENSION_NAME } .zip` ) ) {
301+ throw new Error ( `Expected ZIP not found: ${ FIREFOX_EXTENSION_NAME } .zip` ) ;
302+ }
294303 }
295304
296305 if ( target === 'all' || target === 'standalone' ) {
297306 createZip ( path . join ( BUILD_DIR , 'standalone' ) , `${ STANDALONE_NAME } .zip` ) ;
307+ if ( ! fs . existsSync ( `${ STANDALONE_NAME } .zip` ) ) {
308+ throw new Error ( `Expected ZIP not found: ${ STANDALONE_NAME } .zip` ) ;
309+ }
298310 }
299311
300312 log ( '✅ Distribution packages created' , colors . green ) ;
0 commit comments