feat: 生成脚本

This commit is contained in:
richarjiang
2026-03-16 08:52:44 +08:00
parent 8e9af19c88
commit a230122faf
8 changed files with 1345 additions and 5 deletions

40
scripts/seed-mock-data.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
# 一键生成模拟数据脚本
# 使用方法: bash scripts/seed-mock-data.sh
set -e
echo "🦀 OpenClaw Market 模拟数据生成器"
echo "=================================="
echo ""
# 检查环境变量
if [ -z "$DATABASE_URL" ]; then
echo "❌ 错误: DATABASE_URL 环境变量未设置"
exit 1
fi
if [ -z "$REDIS_URL" ]; then
echo "⚠️ 警告: REDIS_URL 环境变量未设置Redis 同步可能会失败"
fi
# 步骤 1: 清理旧数据
echo "📦 步骤 1/3: 清理旧数据..."
npx tsx scripts/clear-mock-data.ts
echo ""
# 步骤 2: 生成新数据
echo "📦 步骤 2/3: 生成模拟数据..."
npx tsx scripts/generate-mock-data.ts
echo ""
# 步骤 3: 同步 Redis
echo "📦 步骤 3/3: 同步 Redis 统计..."
npx tsx scripts/sync-redis-stats.ts
echo ""
echo "=================================="
echo "✨ 全部完成!现在可以启动开发服务器查看效果:"
echo " pnpm dev"
echo ""