Files
geMoldInsight/deploy.sh
T
cjw eab4137c0a fix(frontend)+chore(deploy): 修复明细表格渲染 + static/ 改服务器构建
- SalesOrdersTab/PurchaseOrdersTab/MaterialsTab/ProductsTab: t-table 明细行不渲染(push/splice 改新数组引用)+ Decimal 算术类型错误(Number() 包裹)
- static/ 不再进 git(.gitignore),改为 deploy.sh 在服务器 npm run build
- 新增 deploy.sh:拉取 + 构建前端 + 重启后端
2026-08-03 16:12:34 +08:00

38 lines
1.0 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.
#!/bin/bash
# 部署脚本:拉取代码 + 构建前端 + 重启后端
# 用法:./deploy.sh
# 前提:服务器已安装 Node.js(node --version 能输出版本)
set -e
cd "$(dirname "$0")"
# ── 1. 检查 Node.js ──
if ! command -v node &> /dev/null; then
echo "❌ 服务器未安装 Node.js,无法构建前端"
echo " 安装(Debian/Ubuntu):"
echo " curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -"
echo " sudo apt-get install -y nodejs"
exit 1
fi
echo "✅ Node.js: $(node --version)"
# ── 2. 拉取最新代码 ──
echo "=== 拉取最新代码 ==="
git pull
# ── 3. 构建前端(产物输出到 ../static/)──
echo "=== 构建前端 ==="
cd frontend
npm install
npm run build
cd ..
# ── 4. 重启后端服务 ──
echo "=== 重启后端服务 ==="
sudo systemctl restart gemoldinsight
sleep 2
sudo systemctl status gemoldinsight --no-pager | head -8
echo ""
echo "=== 部署完成 ==="
echo "前端已构建到 static/,后端已重启。"