fix(console): 默认端口改 19540;打包改为手动组装便携版(不依赖 GitHub 下载)
This commit is contained in:
1 parent
c92b404f6e
commit
e47251658b
2 files changed
+53
-8
No files matched your search
@@ -10,7 +10,7 @@ const DEFAULTS = {
|
|||||||
exe: 'scoreboard.exe',
|
exe: 'scoreboard.exe',
|
||||||
args: ['-config', 'config.yaml'],
|
args: ['-config', 'config.yaml'],
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 8080,
|
port: 19540,
|
||||||
autoStart: true,
|
autoStart: true,
|
||||||
healthIntervalMs: 5000,
|
healthIntervalMs: 5000,
|
||||||
restartDelayMs: 3000,
|
restartDelayMs: 3000,
|
||||||
|
|||||||
+52
-7
@@ -1,28 +1,73 @@
|
|||||||
@echo off
|
@echo off
|
||||||
REM 在 Windows 构建机(Meowhome)上一键构建 Windows 产物。
|
REM 在 Windows 构建机(Meowhome)上一键构建 Windows 产物。
|
||||||
REM 产物:dist\scoreboard.exe(前端已由 go:embed 内嵌)
|
REM 产物:
|
||||||
|
REM dist\scoreboard.exe 服务端(前端已 go:embed 内嵌)
|
||||||
|
REM dist\console\ScoreboardConsole\ 便携版 GUI 管理器(双击即用,免安装)
|
||||||
|
REM
|
||||||
|
REM 说明:不用 electron-builder 的 NSIS 打包,因为它会从 GitHub 下载签名工具,
|
||||||
|
REM 离线/受限网络下必失败。改为手动组装便携版:Electron 运行时 + resources\app。
|
||||||
setlocal
|
setlocal
|
||||||
|
|
||||||
|
REM Electron 版本必须与 console\package.json 的 devDependencies.electron 一致(锁在 console\pnpm-lock.yaml)
|
||||||
|
set "ELECTRON_VERSION=38.8.6"
|
||||||
|
set "ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron"
|
||||||
|
set "CONSOLE_OUT=dist\console\ScoreboardConsole"
|
||||||
|
|
||||||
cd /d "%~dp0.."
|
cd /d "%~dp0.."
|
||||||
|
|
||||||
echo === [1/4] git pull ===
|
echo === [1/5] git pull ===
|
||||||
git pull || exit /b 1
|
git pull || exit /b 1
|
||||||
|
|
||||||
echo === [2/4] pnpm install ===
|
echo === [2/5] 前端依赖与构建 ===
|
||||||
cd web
|
cd web
|
||||||
call pnpm install --frozen-lockfile || exit /b 1
|
call pnpm install --frozen-lockfile || exit /b 1
|
||||||
|
|
||||||
echo === [3/4] 前端构建(输出到 server\internal\webui\assets) ===
|
|
||||||
call pnpm build || exit /b 1
|
call pnpm build || exit /b 1
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
echo === [4/4] go build ===
|
echo === [3/5] 服务端构建 ===
|
||||||
cd server
|
cd server
|
||||||
if not exist ..\dist mkdir ..\dist
|
if not exist ..\dist mkdir ..\dist
|
||||||
go build -o ..\dist\scoreboard.exe . || exit /b 1
|
go build -o ..\dist\scoreboard.exe . || exit /b 1
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
echo === [4/5] Console 依赖 + Electron 二进制 ===
|
||||||
|
cd console
|
||||||
|
call pnpm install --frozen-lockfile || exit /b 1
|
||||||
|
call :ensure_electron || exit /b 1
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo === [5/5] 组装便携版 Console ===
|
||||||
|
rmdir /s /q "%CONSOLE_OUT%" 2>nul
|
||||||
|
mkdir "%CONSOLE_OUT%" || exit /b 1
|
||||||
|
xcopy /e /i /y "console\node_modules\electron\dist" "%CONSOLE_OUT%" >nul || exit /b 1
|
||||||
|
mkdir "%CONSOLE_OUT%\resources\app" 2>nul
|
||||||
|
xcopy /e /i /y "console\main" "%CONSOLE_OUT%\resources\app\main" >nul || exit /b 1
|
||||||
|
xcopy /e /i /y "console\renderer" "%CONSOLE_OUT%\resources\app\renderer" >nul || exit /b 1
|
||||||
|
copy /y "console\package.json" "%CONSOLE_OUT%\resources\app\package.json" >nul || exit /b 1
|
||||||
|
REM config.json 必须放在 exe 同级(Console 按 exe 目录解析配置)
|
||||||
|
copy /y "console\config.json" "%CONSOLE_OUT%\config.json" >nul || exit /b 1
|
||||||
|
copy /y "dist\scoreboard.exe" "%CONSOLE_OUT%\scoreboard.exe" >nul || exit /b 1
|
||||||
|
copy /y "config.yaml" "%CONSOLE_OUT%\config.yaml" >nul || exit /b 1
|
||||||
|
ren "%CONSOLE_OUT%\electron.exe" "Scoreboard Console.exe" || exit /b 1
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo === 构建完成 ===
|
echo === 构建完成 ===
|
||||||
dir dist
|
echo dist\scoreboard.exe 服务端
|
||||||
|
echo %CONSOLE_OUT%\Scoreboard Console.exe GUI 管理器(双击运行)
|
||||||
|
dir "%CONSOLE_OUT%"
|
||||||
endlocal
|
endlocal
|
||||||
|
exit /b 0
|
||||||
|
|
||||||
|
REM ---- 确保 Electron 二进制就位(pnpm 默认跳过 postinstall) -------------------
|
||||||
|
:ensure_electron
|
||||||
|
if exist node_modules\electron\dist\electron.exe (
|
||||||
|
echo Electron 二进制已就绪
|
||||||
|
exit /b 0
|
||||||
|
)
|
||||||
|
echo 下载 Electron %ELECTRON_VERSION% ...
|
||||||
|
curl -L --fail --max-time 900 -o electron-dl.zip "%ELECTRON_MIRROR%/%ELECTRON_VERSION%/electron-v%ELECTRON_VERSION%-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 二进制已放置
|
||||||
|
exit /b 0
|
||||||
Reference in new issue
Block a user