Files
iAOP/deploy/fba/build-ui.sh
T

44 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# =============================================================================
# iAOP FBA UI 构建流水线(Epic #163 / issue #164 [A1])
#
# 用法:
# ./deploy/fba/build-ui.sh [--src DIR] [--out DIR]
# --src FBA UI 工程目录(默认 deploy/fba/fba-ui-src)
# --out 产物输出目录(默认 deploy/fba/artifacts)
#
# 流程:pnpm install → 生产构建 → 打 tar 到 artifacts/
# 产物:artifacts/fba-ui-dist.tar.gz(解压后 dist/ 即 nginx 站点目录)
#
# 环境要求:Node.js >= 18.18、pnpm >= 9(Vben5 monorepo)
# =============================================================================
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
SRC="${SRC_DIR:-$ROOT/deploy/fba/fba-ui-src}"
OUT="${OUT_DIR:-$ROOT/deploy/fba/artifacts}"
APP_DIR="$SRC/apps/web-antdv-next"
# 1) 参数校验
[ -d "$APP_DIR" ] || { echo "[fail] 未找到 UI 工程: $APP_DIR"; exit 1; }
mkdir -p "$OUT"
# 2) 环境检查
command -v node >/dev/null || { echo "[fail] 缺少 node(>=18.18)"; exit 1; }
command -v pnpm >/dev/null || { echo "[fail] 缺少 pnpm(>=9),请先安装: npm i -g pnpm"; exit 1; }
echo "[1/4] 依赖安装(pnpm install)..."
cd "$SRC"
pnpm install --frozen-lockfile=false
echo "[2/4] 生产构建(web-antdv-next)..."
cd "$APP_DIR"
pnpm run build
echo "[3/4] 打包 dist/ -> $OUT/fba-ui-dist.tar.gz"
cd "$APP_DIR"
tar -czf "$OUT/fba-ui-dist.tar.gz" dist/
echo "[4/4] 完成:$OUT/fba-ui-dist.tar.gz"
ls -lh "$OUT/fba-ui-dist.tar.gz"