Files
AIGC/demo/frontend/build-for-baota.sh

45 lines
1.1 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
# 前端打包脚本 - Linux
echo "========================================"
echo " 前端打包脚本 - Linux"
echo "========================================"
echo ""
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo "[1/3] 安装依赖..."
npm install
if [ $? -ne 0 ]; then
echo -e "${RED}错误: 依赖安装失败${NC}"
exit 1
fi
echo ""
echo "[2/3] 构建生产版本..."
npm run build
if [ $? -ne 0 ]; then
echo -e "${RED}错误: 构建失败${NC}"
exit 1
fi
echo ""
echo "========================================"
echo " 打包完成!"
echo "========================================"
echo ""
echo -e "${GREEN}打包文件位置: frontend/dist/${NC}"
echo ""
echo "部署到宝塔步骤:"
echo "1. 直接上传 frontend/dist 目录下的所有文件到服务器"
echo "2. 上传到网站根目录(如:/www/wwwroot/your-domain"
echo "3. 在宝塔面板配置 Nginx 为 Vue Router 模式"
echo ""
echo "上传命令示例:"
echo " scp -r dist/* root@your-server:/www/wwwroot/your-domain/"
echo ""