#!/usr/bin/env node const { execSync } = require('child_process'); const fs = require('fs'); const path = require('path'); console.log('šŸŽØ Setting up GaPlace...\n'); // Check if required files exist const requiredFiles = [ 'backend/.env', 'frontend/.env.local' ]; console.log('šŸ“‹ Checking environment files...'); requiredFiles.forEach(file => { if (!fs.existsSync(file)) { console.log(`āŒ Missing: ${file}`); process.exit(1); } else { console.log(`āœ… Found: ${file}`); } }); // Build shared package console.log('\nšŸ“¦ Building shared package...'); try { execSync('npm run build', { cwd: 'shared', stdio: 'inherit' }); console.log('āœ… Shared package built successfully'); } catch (error) { console.error('āŒ Failed to build shared package'); process.exit(1); } // Install dependencies for all workspaces console.log('\nšŸ“¦ Installing dependencies...'); try { execSync('npm install', { stdio: 'inherit' }); console.log('āœ… Dependencies installed successfully'); } catch (error) { console.error('āŒ Failed to install dependencies'); process.exit(1); } // Build backend console.log('\nšŸ”§ Building backend...'); try { execSync('npm run build', { cwd: 'backend', stdio: 'inherit' }); console.log('āœ… Backend built successfully'); } catch (error) { console.error('āŒ Failed to build backend'); process.exit(1); } // Build frontend console.log('\nšŸŽØ Building frontend...'); try { execSync('npm run build', { cwd: 'frontend', stdio: 'inherit' }); console.log('āœ… Frontend built successfully'); } catch (error) { console.error('āŒ Failed to build frontend'); process.exit(1); } console.log('\nšŸš€ Setup complete! To start development:'); console.log(''); console.log('1. Start databases:'); console.log(' docker-compose up redis postgres -d'); console.log(''); console.log('2. Start development servers:'); console.log(' npm run dev'); console.log(''); console.log('3. Open http://localhost:3000 in your browser'); console.log(''); console.log('šŸŽØ Welcome to GaPlace! ✨');