#!/usr/bin/env bash # 建置 gateway + web 依賴 set -euo pipefail # shellcheck source=_common.sh source "$(cd "$(dirname "$0")" && pwd)/_common.sh" require_cmd go require_cmd npm log "build backend…" cd "$BACKEND_DIR" go build -o bin/gateway . go build -o bin/worker ./cmd/worker 2>/dev/null || log "worker build skipped/failed (optional)" log "npm install web…" cd "$WEB_DIR" if [[ ! -d node_modules ]]; then npm ci 2>/dev/null || npm install else log "node_modules exists — skip full install (npm install 若缺依賴可手動)" fi log "build done → $BACKEND_DIR/bin/gateway"