#!/bin/bash

# 设置错误时退出
set -e
# 进入项目根目录
cd $(dirname $0)/../../..
rm -rf dist-prod
rm -rf dist-prod.tar.gz

# 安装依赖
echo "Installing dependencies..."
npm install

# 构建生产环境
echo "Building for production..."
npm run build:prod

# 检查构建结果
if [ -d "dist-prod" ]; then
    echo "Build successful!"
else
    echo "Build failed!"
    exit 1
fi
