2026-09-08 11:34:01 +08:00

39 lines
869 B
Bash
Executable File
Raw Permalink 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.

#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
# ── 前置检查:Bun ──
if ! command -v bun &>/dev/null; then
echo "❌ 未检测到 Bun"
echo ""
echo "安装 Bun:"
echo " curl -fsSL https://bun.sh/install | bash"
exit 1
fi
echo "📦 安装依赖..."
bun install
echo "🔨 编译为 Linux 单二进制..."
bun build ./src/analyze.ts \
--compile \
--target=bun-linux-x64 \
--outfile=dist/analyze
chmod +x dist/analyze
SIZE=$(du -h dist/analyze | cut -f1)
echo ""
echo "✅ 编译完成"
echo " 产物: dist/analyze"
echo " 大小: ${SIZE}"
echo ""
echo "注意: 运行时仅需网络访问火山方舟 API(ark.cn-beijing.volces.com)+ ARK_API_KEY。"
echo ""
echo "部署到编译服务器:"
echo " scp dist/analyze build-server:/usr/local/bin/analyze"