Files
CurrenciCombo/scripts/fix-frontend.ps1
defiQUG 3dc8592b83 docs: Update CHANGELOG and README for deployment models and troubleshooting
- Added multi-platform deployment architecture details (Web App, PWA, DApp) to README.md.
- Included comprehensive troubleshooting guides and fix scripts in README.md.
- Enhanced CHANGELOG.md with new features, fixes, and improvements, including TypeScript error resolutions and updated documentation structure.
- Revised development setup instructions in DEV_SETUP.md to reflect changes in script usage and environment variable setup.
2025-11-06 08:09:54 -08:00

61 lines
2.3 KiB
PowerShell
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Frontend Fix Script
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host " FRONTEND FIX SCRIPT" -ForegroundColor Cyan
Write-Host "========================================`n" -ForegroundColor Cyan
# Step 1: Stop existing webapp
Write-Host "1. Stopping existing webapp..." -ForegroundColor Yellow
$webappProcess = Get-Process node -ErrorAction SilentlyContinue | Where-Object {
(Get-NetTCPConnection -OwningProcess $_.Id -ErrorAction SilentlyContinue | Where-Object { $_.LocalPort -eq 3000 })
}
if ($webappProcess) {
Stop-Process -Id $webappProcess.Id -Force -ErrorAction SilentlyContinue
Write-Host " ✅ Stopped webapp process" -ForegroundColor Green
Start-Sleep -Seconds 2
}
# Step 2: Clear Next.js cache
Write-Host "`n2. Clearing Next.js cache..." -ForegroundColor Yellow
cd webapp
if (Test-Path ".next") {
Remove-Item -Recurse -Force .next -ErrorAction SilentlyContinue
Write-Host " ✅ Cleared .next cache" -ForegroundColor Green
} else {
Write-Host " No cache to clear" -ForegroundColor Gray
}
# Step 3: Check/Create .env.local
Write-Host "`n3. Checking environment variables..." -ForegroundColor Yellow
if (-not (Test-Path ".env.local")) {
@"
NEXT_PUBLIC_ORCH_URL=http://localhost:8080
NEXTAUTH_SECRET=dev-secret-change-in-production-min-32-chars
"@ | Out-File -FilePath ".env.local" -Encoding utf8
Write-Host " [OK] Created .env.local" -ForegroundColor Green
} else {
Write-Host " [OK] .env.local exists" -ForegroundColor Green
}
# Step 4: Verify dependencies
Write-Host "`n4. Checking dependencies..." -ForegroundColor Yellow
if (-not (Test-Path "node_modules")) {
Write-Host " ⚠️ node_modules not found. Installing..." -ForegroundColor Yellow
npm install
} else {
Write-Host " [OK] Dependencies installed" -ForegroundColor Green
}
# Step 5: Start webapp
Write-Host "`n5. Starting webapp..." -ForegroundColor Yellow
Write-Host " Starting in new window..." -ForegroundColor Gray
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$PWD'; npm run dev" -WindowStyle Normal
Write-Host "`n[OK] Webapp starting!" -ForegroundColor Green
Write-Host " Wait 10-15 seconds for Next.js to compile" -ForegroundColor Yellow
Write-Host " Then open: http://localhost:3000" -ForegroundColor Cyan
Write-Host ""
cd ..