Files
ark-stronghold-protocol/scripts/start-windows.bat
T
sganggs bb5c792a4d Node 22+ everywhere, LF text on Windows checkouts, CI actions v7
- Node minimum is 22 in package.json engines, the start scripts, the service installer, setup and doctor,
  matching the README, the release notes and the CI matrix (22 / 24).
- .gitattributes: CSS, HTML, JSON, Markdown and YAML check out with LF, so `node --test` on Windows matches the
  CSS rules the UI tests read; the Windows test step is no longer continue-on-error.
- CI: actions/checkout@v7 and actions/setup-node@v7 (Node 24 runtime).
2026-10-02 16:51:44 +08:00

54 lines
1.7 KiB
Batchfile

@echo off
rem Stronghold Protocol - double-click to start (Windows). Docs: docs\DEPLOY.md
rem Checks Node.js, installs dependencies on the first run, runs tools\setup.mjs (art download / resume),
rem starts the server, prints the LAN addresses and opens the browser. Extra arguments are passed to
rem scripts\launch.mjs, e.g.: start-windows.bat --port 3001 --no-local
chcp 65001 >nul
setlocal EnableExtensions
title 卫戍协议:盟约 - Stronghold Protocol
cd /d "%~dp0.."
where node >nul 2>nul
if errorlevel 1 goto :nonode
node -e "process.exit(Number(process.versions.node.split('.')[0])>=22?0:1)"
if errorlevel 1 goto :oldnode
if not exist "node_modules\ws\package.json" (
echo [首次运行] 正在安装依赖 npm ci ...
call npm ci --no-audit --no-fund || call npm install --no-audit --no-fund
if errorlevel 1 goto :fail
)
node scripts\launch.mjs %*
if errorlevel 1 goto :fail
exit /b 0
:nonode
echo.
echo 未找到 Node.js(需要 22 或更高,22 / 24 LTS)。Node.js not found.
echo.
echo 方法一:在 PowerShell 或命令提示符中运行
echo winget install OpenJS.NodeJS.LTS
echo 方法二:从官网下载安装包 https://nodejs.org/zh-cn/download
echo.
echo 安装完成后请关闭本窗口,再重新双击 start-windows.bat。
echo.
pause
exit /b 1
:oldnode
echo.
for /f "delims=" %%v in ('node -v') do echo 当前 Node.js 版本 %%v 太旧,需要 22 或更高(22 / 24 LTS)。
echo 升级:winget upgrade OpenJS.NodeJS.LTS 或 https://nodejs.org/zh-cn/download
echo.
pause
exit /b 1
:fail
echo.
echo 启动失败,请查看上面的错误信息。诊断:node tools\doctor.mjs
echo Start failed - see the messages above. Diagnose with: node tools\doctor.mjs
echo.
pause
exit /b 1