From 8c92138d8af229ed4d880e31120f10f99a938251 Mon Sep 17 00:00:00 2001 From: chengpeiquan Date: Mon, 17 Mar 2025 00:42:05 +0800 Subject: [PATCH] fix: try to resolve windows build error --- scripts/build.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index 0857b66..a6c44ff 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,5 +1,5 @@ import { execSync } from 'node:child_process' -import { chmodSync, existsSync, mkdirSync } from 'node:fs' +import { chmodSync, copyFileSync, existsSync, mkdirSync } from 'node:fs' import { join } from 'node:path' const WIN_OUTPUT_NAME = 'Git_Commit_Analytics_win.exe' @@ -15,9 +15,7 @@ async function buildWin() { try { console.log(`📦 Creating standalone executable for Windows...`, OUTPUT_PATH) - execSync( - `node -e "require('fs').copyFileSync(process.execPath, '${OUTPUT_PATH}')" `, - ) + copyFileSync(NODE_PATH, OUTPUT_PATH) if (existsSync(OUTPUT_PATH)) { console.log(`✅ The file was successfully copied to: ${OUTPUT_PATH}`) @@ -107,6 +105,7 @@ async function build() { process.exit(1) } + console.log('🚀 Building standalone executable...', NODE_PATH) const buildTask = IS_WIN ? buildWin : buildMac const isSuccess = await buildTask()