diff --git a/README.md b/README.md index db8f1b9..2c94266 100644 --- a/README.md +++ b/README.md @@ -12,20 +12,23 @@ ```powershell # 1. 构建网关二进制到 bin/ -make build +powershell -File scripts/build-gateway.ps1 +# 或:go build -o bin/gateway.exe ./cmd/gateway # 2. 安装前端依赖 npm install # 3. 启动桌面端(自动构建网关并启动 Tauri dev) -make dev +powershell -File scripts/dev.ps1 +# 或直接:npm run tauri dev ``` ## 测试 ```powershell -make test # Go 单元测试与集成测试 -npm test # 前端 vitest +powershell -File scripts/test.ps1 # Go + 前端全部测试 +go test ./... # 仅 Go +npm test # 仅前端 npm run typecheck ``` diff --git a/scripts/dev.ps1 b/scripts/dev.ps1 new file mode 100644 index 0000000..68cf9b3 --- /dev/null +++ b/scripts/dev.ps1 @@ -0,0 +1,13 @@ +# Builds the gateway binary (when missing) and starts the Tauri dev app. +param([switch]$NoBuild) + +$ErrorActionPreference = "Stop" +$repoRoot = Split-Path -Parent $PSScriptRoot +Set-Location $repoRoot + +$gateway = Join-Path $repoRoot "bin\gateway.exe" +if (-not $NoBuild -and -not (Test-Path $gateway)) { + & (Join-Path $PSScriptRoot "build-gateway.ps1") +} + +npm run tauri dev diff --git a/scripts/test.ps1 b/scripts/test.ps1 new file mode 100644 index 0000000..1fc4b18 --- /dev/null +++ b/scripts/test.ps1 @@ -0,0 +1,13 @@ +# Runs the full test suite: Go tests, then frontend vitest. +param([switch]$SkipFrontend) + +$ErrorActionPreference = "Stop" +$repoRoot = Split-Path -Parent $PSScriptRoot +Set-Location $repoRoot + +go test ./... +if ($LASTEXITCODE -ne 0) { exit 1 } + +if (-not $SkipFrontend) { + npm test +}