From da415526cd5810669ccd6b93ea871b30ec174acf Mon Sep 17 00:00:00 2001 From: Tian Feng Date: Tue, 19 Mar 2024 10:05:47 -0700 Subject: [PATCH 1/2] refactor: No error catch in zip method --- src/zip.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/zip.ts b/src/zip.ts index edee00a..49cd32a 100644 --- a/src/zip.ts +++ b/src/zip.ts @@ -103,12 +103,6 @@ function getCommand(source: string, dest: string): string { * @param dest The path where the output zip file should be saved. */ export function zip(workspace: string, source: string, dest: string) { - try { - validate(workspace, source, dest); - execSync(getCommand(source, dest)); - } catch (error) { - console.error( - `Zip file creation failed for destination: "${dest}", source: "${source}". Error: ${error}.`, - ); - } + validate(workspace, source, dest); + execSync(getCommand(source, dest)); } From e8a6ec6fcee25c1b0311d1183ec8f29d15b286fe Mon Sep 17 00:00:00 2001 From: Tian Feng Date: Tue, 19 Mar 2024 10:43:36 -0700 Subject: [PATCH 2/2] fix: Need powershell to exec command --- src/zip.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zip.ts b/src/zip.ts index 49cd32a..ae059f0 100644 --- a/src/zip.ts +++ b/src/zip.ts @@ -89,7 +89,7 @@ function getCommand(source: string, dest: string): string { case 'darwin': return `zip -ryq "${dest}" "${source}"`; case 'win32': - return `Compress-Archive -Path ${source} -DestinationPath ${dest} -Force`; + return `powershell -Command "Compress-Archive -Path ${source} -DestinationPath ${dest} -Force"`; default: throw new Error(`Unsupported operating system: ${osPlatform}`); }