docs: fix setup command paths

This commit is contained in:
2026-07-21 21:37:03 +08:00
parent fff6cdcba7
commit e5dd26719b
2 changed files with 43 additions and 21 deletions

View File

@@ -51,9 +51,11 @@ Web 客户端桌面优先,同时保留移动浏览器可用性;登录页允
### 2. 启动 PostgreSQL
在仓库目录运行:
任意仓库目录运行:
```powershell
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location $repoRoot
docker compose -f infra/docker-compose.yml up -d
```
@@ -62,7 +64,8 @@ Compose 只用于本地开发,创建 PostgreSQL 16 服务并监听 `localhost:
### 3. 初始化演示数据
```powershell
Set-Location backend
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go run ./cmd/seed
```
@@ -73,7 +76,8 @@ go run ./cmd/seed
在新的终端中运行:
```powershell
Set-Location backend
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go run ./cmd/api
```
@@ -84,12 +88,13 @@ go run ./cmd/api
在新的终端中运行:
```powershell
Set-Location apps/web_v1
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/web_v1')
npm ci
npm run dev
```
Vite 默认地址为 `http://localhost:5173`。登录服务器地址填写 `http://localhost:9150`也可以通过 `VITE_API_BASE_URL` 指定 Web 的初始 API 地址。
Vite 默认地址为 `http://localhost:5173`。登录页的服务器地址默认是 `http://localhost:9150`用户可以改为私有部署服务器的 IP 地址或域名,登录及后续 API 请求会使用用户填写的地址。
## 配置
@@ -144,14 +149,16 @@ Vite 默认地址为 `http://localhost:5173`。登录时服务器地址填写 `h
后端:
```powershell
Set-Location backend
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go test ./...
```
Web
```powershell
Set-Location apps/web_v1
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/web_v1')
node scripts/visual-check.mjs
npm run build
npm run lint
@@ -160,7 +167,8 @@ npm run lint
如果设置了指向隔离测试库的 `DATABASE_URL`,再运行 PostgreSQL 集成检查:
```powershell
Set-Location backend
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go test -tags integration ./internal/models -run TestPostgresPing -v
```
@@ -171,7 +179,8 @@ go test -tags integration ./internal/models -run TestPostgresPing -v
先完成 Web 依赖安装,再构建 Tauri 可执行文件:
```powershell
Set-Location apps/desktop
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/desktop')
npm ci
npm run build
```
@@ -181,7 +190,8 @@ npm run build
需要安装包时运行:
```powershell
Set-Location apps/desktop
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/desktop')
npm run bundle
```