Refactor infrastructure scripts and add mock hardware support

Changes:
- Refactor project scripts for better dev/prod workflow separation
- Add mock_hardware.py for local development without real hardware
- Add Makefile for common commands
- Add .env.example for environment variable reference
- Split scripts into dev-backend.sh, dev-frontend.sh, prod-backend.sh
- Add stop.sh for clean shutdown

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 12:31:32 +08:00
parent 1429442dbd
commit cb6498cd2b
12 changed files with 592 additions and 167 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# ============================================================
# dev-frontend.sh - 前端开发启动
# 用法: ./scripts/dev-frontend.sh
# 说明: 启动 Next.js 开发服务器,API 代理到后端
# ============================================================
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
FRONTEND_DIR="$SCRIPT_DIR/../public-frontend"
echo "=========================================="
echo " 前端开发模式 - Next.js"
echo "=========================================="
echo ""
echo " 后端 URL: ${BACKEND_URL:-http://127.0.0.1:5000}"
echo " 访问: http://localhost:3000"
echo " Ctrl+C 停止"
echo ""
# 确保后端 URL 设置(默认本地)
export BACKEND_URL=${BACKEND_URL:-http://127.0.0.1:5000}
export NEXT_PUBLIC_BACKEND_URL=${BACKEND_URL}
cd "$FRONTEND_DIR"
exec npm run dev