From 3cba5df5c707a2d6e79da1efa9273f098ca1f889 Mon Sep 17 00:00:00 2001 From: NanamiAdmin Date: Thu, 10 Sep 2026 21:01:13 +0800 Subject: [PATCH] docs(readme): update build instructions --- README.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fe75d49..8c3903f 100644 --- a/README.md +++ b/README.md @@ -326,16 +326,33 @@ QQ and Telegram are *interactive* channels. Email, ntfy, and webhook are **statu ## Building -Requires Go 1.25+. Repo includes helper scripts that bake the current git commit and build time into the binary via `-ldflags`: +Requires Go 1.25+ and — to build the web console — Node.js 22+. + +Helper scripts in the repo root bake the current git commit and build time into the binary via `-ldflags`. The name states the **target** platform, and each target has a Windows (`.bat`) and a Linux/macOS (`.sh`) flavor: run the flavor for the host you are building on, since every script cross-compiles to its target. + +| Script | Output | +|---|---| +| `build-linux-x86_64.sh` / `build-linux-x86_64.bat` | `nukumizu-linux-amd64` | +| `build-win-x86_64.sh` / `build-win-x86_64.bat` | `nukumizu-windows-amd64.exe` | ```bash -# Windows (cross-compile to Linux amd64) -build-linux-x86_64.bat +# Linux / macOS +./build-linux-x86_64.sh +./build-win-x86_64.sh -# Windows amd64 +# Windows +build-linux-x86_64.bat build-win-x86_64.bat ``` +Pass `--frontend` to build the Vue console first (`npm ci` + `npm run build` inside `frontend/`); without it only the backend is compiled: + +```bash +./build-linux-x86_64.sh --frontend +``` + +The console is **not embedded in the binary** — `web/` reads `frontend/dist` from disk at runtime. A binary built without `--frontend` still starts and serves the API, but `/` answers `500 index.html not found` until a built `frontend/dist` sits in the working directory. Build it once with `--frontend`, then re-run any of the four scripts without the flag. + Equivalent manual builds: ```bash @@ -352,6 +369,8 @@ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \ `main.CommitHash` and `main.BuildTime` are surfaced in logs and in the `BOT_STARTED` message. +CI (`.github/workflows/build.yml`) runs both flavors — `.sh` on `ubuntu-latest`, `.bat` on `windows-latest` — and uploads the two binaries plus the frontend bundle as artifacts. + ## Running Both `config.json` and `bot_user_config.json` must exist in the working directory (or be passed explicitly):