docs: 说明新克隆可直接编译(static/ 留了占位页)

This commit is contained in:
2026-09-02 10:33:03 +08:00
parent c73dd10f9c
commit 00ba69d899
2 changed files with 15 additions and 67 deletions

View File

@ -53,9 +53,13 @@ npm 只在构建期用到:Node ≥ 18(`npm run build`)与 Go ≥ 1.22。
`web/dist` 会被复制进 `gateway/internal/static/static/` 再由 `go:embed` 编入二进制,
**部署机上不需要 node**。
`web/node_modules`、`web/dist`、`gateway/internal/static/static/` 与编译出的二进制都是
构建产物,不进版本库(见 `.gitignore`)。因此**克隆后必须先跑一次 `deploy/install.sh`**
——`go:embed` 要求那个目录存在才能编译,否则 `go build` 直接失败。只想编 Go 的话:
`web/node_modules`、`web/dist`、`gateway/internal/static/static/` 的内容与编译出的二进制
都是构建产物,不进版本库(见 `.gitignore`)。
新克隆**可以直接 `go build` / `go test`**:`static/` 目录里留了一个占位 index.html
(`go:embed` 要求目标目录存在,否则编译失败——只改后端的人不该被迫先装 node)。
此时打开网页看到的是「前端未构建」提示页,API 照常可用。要真正的界面就跑
`deploy/install.sh`,或手工:
```bash
cd web && npm ci && npm run build