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).
This commit is contained in:
1 parent
b59aa15ee2
commit
bb5c792a4d
12 files changed
+31
-26
No files matched your search
@@ -118,7 +118,7 @@ try {
|
||||
if (-not $nodeCmd) { throw '未找到 Node.js:请先安装(winget install OpenJS.NodeJS.LTS),然后重新打开 PowerShell。' }
|
||||
$nodeExe = $nodeCmd.Source
|
||||
$major = [int](((& $nodeExe -v) -replace '^v', '').Split('.')[0])
|
||||
if ($major -lt 18) { throw "Node.js 版本太旧(需要 18+):$(& $nodeExe -v)" }
|
||||
if ($major -lt 22) { throw "Node.js 版本太旧(需要 22+):$(& $nodeExe -v)" }
|
||||
if ($nodeExe -like "$env:USERPROFILE*") {
|
||||
Write-Host "注意:node.exe 位于用户目录($nodeExe,nvm/便携版?)。SYSTEM 账户一般也能运行它;若服务起不来,请改用 winget / 官网安装包安装的 Node.js。" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ import fs from 'node:fs';
|
||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const IS_WIN = process.platform === 'win32';
|
||||
|
||||
if (Number(process.versions.node.split('.')[0]) < 18) {
|
||||
console.error(`Node.js ${process.versions.node} 太旧,需要 18 或更高(推荐 22 LTS):https://nodejs.org/zh-cn/download`);
|
||||
if (Number(process.versions.node.split('.')[0]) < 22) {
|
||||
console.error(`Node.js ${process.versions.node} 太旧,需要 22 或更高(22 / 24 LTS):https://nodejs.org/zh-cn/download`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ cd /d "%~dp0.."
|
||||
|
||||
where node >nul 2>nul
|
||||
if errorlevel 1 goto :nonode
|
||||
node -e "process.exit(Number(process.versions.node.split('.')[0])>=18?0:1)"
|
||||
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" (
|
||||
@@ -25,7 +25,7 @@ exit /b 0
|
||||
|
||||
:nonode
|
||||
echo.
|
||||
echo 未找到 Node.js(需要 18 或更高,推荐 22 LTS)。Node.js not found.
|
||||
echo 未找到 Node.js(需要 22 或更高,22 / 24 LTS)。Node.js not found.
|
||||
echo.
|
||||
echo 方法一:在 PowerShell 或命令提示符中运行
|
||||
echo winget install OpenJS.NodeJS.LTS
|
||||
@@ -38,7 +38,7 @@ exit /b 1
|
||||
|
||||
:oldnode
|
||||
echo.
|
||||
for /f "delims=" %%v in ('node -v') do echo 当前 Node.js 版本 %%v 太旧,需要 18 或更高(推荐 22 LTS)。
|
||||
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
|
||||
|
||||
@@ -31,7 +31,7 @@ function Test-Node {
|
||||
|
||||
$node = Test-Node
|
||||
if (-not $node) {
|
||||
Write-Host '未找到 Node.js(需要 18 或更高,推荐 22 LTS)。' -ForegroundColor Yellow
|
||||
Write-Host '未找到 Node.js(需要 22 或更高,22 / 24 LTS)。' -ForegroundColor Yellow
|
||||
$winget = Get-Command winget -ErrorAction SilentlyContinue
|
||||
if ($winget) {
|
||||
Write-Host '可以用 Windows 自带的 winget 安装: winget install OpenJS.NodeJS.LTS'
|
||||
@@ -49,8 +49,8 @@ if (-not $node) {
|
||||
Pause-Exit 1
|
||||
}
|
||||
}
|
||||
if ($node.Major -lt 18) {
|
||||
Write-Host "Node.js $($node.Version) 太旧,需要 18 或更高:winget upgrade OpenJS.NodeJS.LTS 或 https://nodejs.org/zh-cn/download" -ForegroundColor Red
|
||||
if ($node.Major -lt 22) {
|
||||
Write-Host "Node.js $($node.Version) 太旧,需要 22 或更高:winget upgrade OpenJS.NodeJS.LTS 或 https://nodejs.org/zh-cn/download" -ForegroundColor Red
|
||||
Pause-Exit 1
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# 卫戍协议:盟约 · macOS / Linux start script. Docs: docs/DEPLOY.md
|
||||
# scripts/start.sh [--port 3001] [--no-open] [--no-local] [--no-assets] … (arguments go to scripts/launch.mjs)
|
||||
# Checks Node.js ≥ 18, runs `npm ci` on the first run, then scripts/launch.mjs (tools/setup.mjs → server → browser).
|
||||
# Checks Node.js ≥ 22, runs `npm ci` on the first run, then scripts/launch.mjs (tools/setup.mjs → server → browser).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if ! command -v node >/dev/null 2>&1; then
|
||||
echo "未找到 Node.js(需要 18 或更高,推荐 22 LTS)。Node.js not found."
|
||||
echo "未找到 Node.js(需要 22 或更高,22 / 24 LTS)。Node.js not found."
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
echo " 安装:brew install node@22 或 https://nodejs.org/zh-cn/download"
|
||||
else
|
||||
@@ -14,8 +14,8 @@ if ! command -v node >/dev/null 2>&1; then
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
if ! node -e "process.exit(Number(process.versions.node.split('.')[0])>=18?0:1)"; then
|
||||
echo "Node.js $(node -v) 太旧,需要 18 或更高(推荐 22 LTS):https://nodejs.org/zh-cn/download"
|
||||
if ! node -e "process.exit(Number(process.versions.node.split('.')[0])>=22?0:1)"; then
|
||||
echo "Node.js $(node -v) 太旧,需要 22 或更高(22 / 24 LTS):https://nodejs.org/zh-cn/download"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user