#!/bin/bash

echo "🚀 开始部署 WorkTime 应用..."

# 检查Node.js是否安装
if ! command -v node &> /dev/null; then
    echo "❌ Node.js 未安装，请先安装 Node.js"
    exit 1
fi

# 检查npm是否安装
if ! command -v npm &> /dev/null; then
    echo "❌ npm 未安装，请先安装 npm"
    exit 1
fi

echo "📦 安装依赖..."
npm install

echo "🔨 构建前端应用..."
npm run build

echo "🚀 启动服务器..."
echo "📱 应用地址: http://localhost:3001"
echo "🔧 API健康检查: http://localhost:3001/api/health"
echo ""
echo "按 Ctrl+C 停止服务器"

# 启动服务器
node server.js 