fix(build): pnpm 11 用 allowBuilds 放行 electron 安装脚本

pnpm 11 起 onlyBuiltDependencies 列表形式被静默忽略,导致
ERR_PNPM_IGNORED_BUILDS 让 pnpm run 的依赖校验直接失败(pnpm run dist 都起不来)。
改为 pnpm 自己写入的 allowBuilds 映射形式,并去掉 build.bat 里的 --ignore-scripts。
另外修复 set VAR=value && ... 的尾随空格:它会把 ELECTRON_MIRROR 变成
'.../electron/ v38.8.6/...' 从而 404。
This commit is contained in:
AskaEth committed 2026-09-09 21:35:21 +08:00
1 parent 52edecfa4c
commit 33d4b39eb9
2 files changed
+13 -5

No files matched your search

+5 -2
View File
@@ -52,7 +52,10 @@ node deploy\prepare-extra.mjs || exit /b 1
cd console
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
REM console\pnpm-workspace.yaml 里的 allowBuilds 已经放行 electron 的安装脚本,
REM 因此这里不再加 --ignore-scripts(否则 pnpm run 的依赖校验会以
REM ERR_PNPM_IGNORED_BUILDS 失败)。
call pnpm install --frozen-lockfile || exit /b 1
call :ensure_electron || exit /b 1
call pnpm run dist || exit /b 1
cd ..
@@ -65,7 +68,7 @@ dir /b dist\console
endlocal
exit /b 0
REM ---- ensure the electron runtime binary is present (pnpm skips its postinstall) --
REM ---- ensure the electron runtime binary is present (fallback for mirror failures) --
:ensure_electron
REM path.txt tells the electron package where the binary is; without it
REM electron-builder tries to download the runtime and hits a Node 24 bug.