From 126a4db926bc4085e8e5c87b9c58f5d1018e295f Mon Sep 17 00:00:00 2001 From: chengpeiquan Date: Mon, 17 Mar 2025 00:34:11 +0800 Subject: [PATCH] fix: try to resolve windows build error --- scripts/build.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/build.js b/scripts/build.js index 10724b7..0857b66 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,5 +1,5 @@ import { execSync } from 'node:child_process' -import { existsSync, mkdirSync } from 'node:fs' +import { chmodSync, existsSync, mkdirSync } from 'node:fs' import { join } from 'node:path' const WIN_OUTPUT_NAME = 'Git_Commit_Analytics_win.exe' @@ -19,10 +19,21 @@ async function buildWin() { `node -e "require('fs').copyFileSync(process.execPath, '${OUTPUT_PATH}')" `, ) + if (existsSync(OUTPUT_PATH)) { + console.log(`✅ The file was successfully copied to: ${OUTPUT_PATH}`) + } else { + console.error(`❌ Copy failed, file not found: ${OUTPUT_PATH}`) + process.exit(1) + } + try { execSync(`signtool remove /s ${OUTPUT_PATH}`) } catch {} + try { + chmodSync(OUTPUT_PATH, 0o666) + } catch {} + execSync( [ `postject ${OUTPUT_PATH} NODE_SEA_BLOB ${SEA_BLOB}`, @@ -47,6 +58,13 @@ async function buildMac() { execSync(`cp ${NODE_PATH} ${OUTPUT_PATH}`) + if (existsSync(OUTPUT_PATH)) { + console.log(`✅ The file was successfully copied to: ${OUTPUT_PATH}`) + } else { + console.error(`❌ Copy failed, file not found: ${OUTPUT_PATH}`) + process.exit(1) + } + execSync(`codesign --remove-signature ${OUTPUT_PATH}`) execSync(