fix(build): 恢复手动放置 Electron 运行时的步骤(electron-builder 自下会撞 Node 24 bug)

This commit is contained in:
AskaEth committed 2026-09-09 21:11:02 +08:00
1 parent c3d2c1416f
commit d5b45761d7
1 file changed
+15 -2
+15 -2
View File
@@ -50,9 +50,10 @@ taskkill /im scoreboard.exe /f >nul 2>&1
if not exist "rules" echo [warn] rules dir missing
node deploy\prepare-extra.mjs || exit /b 1
cd console
REM pnpm 11 blocks postinstall by default; electron-builder fetches its own Electron
REM runtime into its cache, so skipping scripts here is safe (and avoids ERR_PNPM_IGNORED_BUILDS).
REM pnpm 11 blocks postinstall by default (ERR_PNPM_IGNORED_BUILDS), so the electron
REM runtime binary is fetched explicitly below instead of relying on the install script.
call pnpm install --frozen-lockfile --ignore-scripts || exit /b 1
call :ensure_electron || exit /b 1
call pnpm run dist || exit /b 1
cd ..
@@ -63,3 +64,15 @@ echo dist\console\ console installer + portable
dir /b dist\console
endlocal
exit /b 0
REM ---- ensure the electron runtime binary is present (pnpm skips its postinstall) --
:ensure_electron
if exist node_modules\electron\dist\electron.exe exit /b 0
set "EV=38.8.6"
echo downloading electron %EV% ...
curl -L --fail --max-time 900 -o electron-dl.zip "%ELECTRON_MIRROR%%EV%/electron-v%EV%-win32-x64.zip" || exit /b 1
powershell -NoProfile -Command "Expand-Archive -LiteralPath 'electron-dl.zip' -DestinationPath 'node_modules/electron/dist' -Force" || exit /b 1
del /q electron-dl.zip
echo electron.exe> node_modules\electron\path.txt
echo electron runtime ready
exit /b 0