Files
pos-system/scripts/setup/init-project.sh
Ho Ngoc Hai 5ff8035013 Remove local development README and enhance scripts for cross-platform compatibility
- Deleted `README.md` for local development setup as it was deemed unnecessary.
- Updated `setup-neon.sh`, `start-all.sh`, and `create-service.sh` scripts to source an OS helper for improved cross-platform command execution.
- Modified commands in `init-project.sh` to reflect the new script structure for starting services.
2025-12-27 10:26:04 +07:00

63 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "🚀 Initializing GoodGo Microservices Project..."
# EN: Check prerequisites
# VI: Kiểm tra các điều kiện tiên quyết
if ! command -v pnpm &> /dev/null; then
echo "❌ PNPM is not installed. Please install it first: npm install -g pnpm"
exit 1
fi
if ! command -v docker &> /dev/null; then
echo "⚠️ Docker is not installed. Some features may not work."
fi
# EN: Install dependencies
# VI: Cài đặt các gói phụ thuộc
echo "📦 Installing dependencies..."
pnpm install
# EN: Generate Prisma clients
# VI: Tạo Prisma generic clients
echo "🔧 Generating Prisma clients..."
cd services/auth-service
pnpm prisma:generate || echo "⚠️ Prisma generation skipped (database not available)"
cd ../..
# EN: Setup environment files
# VI: Thiết lập các file biến môi trường
echo "📝 Setting up environment files..."
if [ ! -f "services/auth-service/.env" ]; then
cp services/auth-service/env.example services/auth-service/.env
echo "✅ Created services/auth-service/.env"
fi
if [ ! -f "deployments/local/.env.local" ]; then
cp deployments/local/env.local.example deployments/local/.env.local
echo "✅ Created deployments/local/.env.local"
echo "⚠️ IMPORTANT: Edit .env.local and add your Neon DATABASE_URL"
fi
if [ ! -f "apps/web-admin/.env.local" ]; then
cp apps/web-admin/.env.example apps/web-admin/.env.local 2>/dev/null || echo "⚠️ Web admin .env.example not found"
fi
if [ ! -f "apps/web-client/.env.local" ]; then
cp apps/web-client/.env.example apps/web-client/.env.local 2>/dev/null || echo "⚠️ Web client .env.example not found"
fi
echo "✅ Project initialization complete!"
echo ""
echo "Next steps:"
echo "1. Setup Neon database: ./scripts/db/setup-neon.sh"
echo "2. Update .env files with your Neon DATABASE_URL"
echo "3. Start all services: ./scripts/dev/start-all.sh"
echo "4. Run migrations: ./scripts/db/migrate.sh auth-service dev"
echo "5. Seed database: ./scripts/db/seed.sh auth-service"
echo "6. Start services: pnpm dev"
echo ""
echo "📚 See infra/databases/neon/README.md for Neon setup details"