Some checks are pending
Build AeThex Engine / build-windows (push) Waiting to run
Build AeThex Engine / build-linux (push) Waiting to run
Build AeThex Engine / build-macos (push) Waiting to run
Build AeThex Engine / create-release (push) Blocked by required conditions
Deploy Docsify Documentation / build (push) Waiting to run
Deploy Docsify Documentation / deploy (push) Blocked by required conditions
155 lines
4.9 KiB
PowerShell
155 lines
4.9 KiB
PowerShell
# AeThex Development Environment Startup Script
|
|
# https://aethex.dev
|
|
# Run this script to start the full development environment
|
|
|
|
param(
|
|
[switch]$SkipDatabase,
|
|
[switch]$SkipBackend,
|
|
[switch]$SkipEngine,
|
|
[switch]$ResetDatabase,
|
|
[switch]$Help
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$ProjectRoot = $PSScriptRoot
|
|
$AuthServicePath = "$ProjectRoot\services\auth-service"
|
|
$EnginePath = "$ProjectRoot\engine"
|
|
|
|
Write-Host "`n=== AeThex Development Environment ===" -ForegroundColor Cyan
|
|
Write-Host "https://aethex.dev`n" -ForegroundColor DarkGray
|
|
|
|
if ($Help) {
|
|
Write-Host "Usage: .\start-dev.ps1 [options]`n"
|
|
Write-Host "Options:"
|
|
Write-Host " -SkipDatabase Skip starting PostgreSQL (if already running)"
|
|
Write-Host " -SkipBackend Skip starting the auth-service"
|
|
Write-Host " -SkipEngine Skip building/launching the engine"
|
|
Write-Host " -ResetDatabase Reset and reseed the database"
|
|
Write-Host " -Help Show this help message"
|
|
exit 0
|
|
}
|
|
|
|
# Check prerequisites
|
|
function Test-Command($cmd) {
|
|
return [bool](Get-Command $cmd -ErrorAction SilentlyContinue)
|
|
}
|
|
|
|
if (-not (Test-Command "docker")) {
|
|
Write-Host "Warning: Docker not found. Database will need to be running separately." -ForegroundColor Yellow
|
|
$SkipDatabase = $true
|
|
}
|
|
|
|
if (-not (Test-Command "npm")) {
|
|
Write-Host "Error: npm not found. Please install Node.js" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
# Step 1: Start Database
|
|
if (-not $SkipDatabase) {
|
|
Write-Host "[1/4] Starting PostgreSQL database..." -ForegroundColor Green
|
|
Push-Location $AuthServicePath
|
|
try {
|
|
docker-compose up -d postgres
|
|
Write-Host " Waiting for database to be ready..."
|
|
Start-Sleep -Seconds 5
|
|
} catch {
|
|
Write-Host " Warning: Could not start database with Docker" -ForegroundColor Yellow
|
|
}
|
|
Pop-Location
|
|
}
|
|
|
|
# Step 2: Setup Backend
|
|
if (-not $SkipBackend) {
|
|
Write-Host "[2/4] Setting up auth-service..." -ForegroundColor Green
|
|
Push-Location $AuthServicePath
|
|
|
|
# Install dependencies if needed
|
|
if (-not (Test-Path "node_modules")) {
|
|
Write-Host " Installing npm dependencies..."
|
|
npm install
|
|
}
|
|
|
|
# Generate Prisma client
|
|
Write-Host " Generating Prisma client..."
|
|
npx prisma generate
|
|
|
|
# Run migrations
|
|
if ($ResetDatabase) {
|
|
Write-Host " Resetting database..."
|
|
npx prisma migrate reset --force
|
|
} else {
|
|
Write-Host " Running database migrations..."
|
|
npx prisma migrate dev --name init 2>$null
|
|
}
|
|
|
|
# Seed database
|
|
Write-Host " Seeding database with demo data..."
|
|
npm run seed
|
|
|
|
# Start backend in background
|
|
Write-Host " Starting auth-service on port 3001..."
|
|
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$AuthServicePath'; npm run dev" -WindowStyle Normal
|
|
|
|
Pop-Location
|
|
Write-Host " Auth service starting at http://localhost:3001" -ForegroundColor Cyan
|
|
}
|
|
|
|
# Step 3: Build Engine (if needed)
|
|
if (-not $SkipEngine) {
|
|
Write-Host "[3/4] Checking AeThex Engine..." -ForegroundColor Green
|
|
Push-Location $EnginePath
|
|
|
|
$engineExe = "bin\aethex.windows.editor.x86_64.exe"
|
|
|
|
if (-not (Test-Path $engineExe)) {
|
|
Write-Host " Building engine (this may take a while)..."
|
|
if (Test-Command "scons") {
|
|
scons platform=windows target=editor -j8
|
|
} else {
|
|
Write-Host " Warning: scons not found. Please build the engine manually." -ForegroundColor Yellow
|
|
}
|
|
} else {
|
|
Write-Host " Engine already built" -ForegroundColor DarkGray
|
|
}
|
|
|
|
Pop-Location
|
|
}
|
|
|
|
# Step 4: Launch Engine
|
|
if (-not $SkipEngine) {
|
|
Write-Host "[4/4] Launching AeThex Engine..." -ForegroundColor Green
|
|
$engineExe = "$EnginePath\bin\aethex.windows.editor.x86_64.exe"
|
|
|
|
if (Test-Path $engineExe) {
|
|
Start-Sleep -Seconds 2 # Wait for backend to initialize
|
|
Start-Process $engineExe -ArgumentList "--project-manager"
|
|
Write-Host " Engine launched!" -ForegroundColor Cyan
|
|
} else {
|
|
Write-Host " Engine executable not found at: $engineExe" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
|
|
Write-Host "`n=== Development Environment Ready ===" -ForegroundColor Green
|
|
Write-Host @"
|
|
|
|
Services:
|
|
- Auth API: http://localhost:3001
|
|
- Health: http://localhost:3001/health
|
|
- Database: postgresql://aethex:aethex_dev@localhost:5432/aethex_dev
|
|
|
|
Demo Account:
|
|
- Email: demo@aethex.dev
|
|
- Password: DemoPass123
|
|
|
|
API Endpoints:
|
|
- POST /api/v1/auth/register - Create account
|
|
- POST /api/v1/auth/login - Login
|
|
- GET /api/v1/auth/me - Get current user
|
|
- GET /api/v1/games - List store games
|
|
- GET /api/v1/games/featured - Featured games
|
|
- GET /api/v1/users/library - User's game library
|
|
|
|
"@ -ForegroundColor DarkGray
|
|
|
|
Write-Host "Press any key to exit this window..." -ForegroundColor DarkGray
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|