-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart-dev.ps1
More file actions
41 lines (34 loc) · 1.78 KB
/
start-dev.ps1
File metadata and controls
41 lines (34 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env pwsh
Write-Host "🚀 Starting Discordant Development Server with Optimized Memory Settings" -ForegroundColor Cyan
# Kill any existing Node processes
Write-Host "🔄 Cleaning up existing Node processes..." -ForegroundColor Yellow
taskkill /F /IM node.exe 2>$null | Out-Null
# Set memory limit to 8GB
Write-Host "💾 Setting Node.js memory limit to 8GB..." -ForegroundColor Green
$env:NODE_OPTIONS="--max-old-space-size=8192"
# Clear Next.js cache
Write-Host "🧹 Clearing Next.js cache..." -ForegroundColor Yellow
if (Test-Path ".next") {
Remove-Item -Path ".next" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "✅ Next.js cache cleared" -ForegroundColor Green
}
# Check if certificates exist
$certPath = "./certs/localhost.pem"
$keyPath = "./certs/localhost-key.pem"
if (-not (Test-Path $certPath) -or -not (Test-Path $keyPath)) {
Write-Host "⚠️ HTTPS certificates not found. Running in HTTP mode..." -ForegroundColor Yellow
Write-Host "📦 Starting development server (HTTP)..." -ForegroundColor Cyan
npm run dev
} else {
Write-Host "🔐 HTTPS certificates found" -ForegroundColor Green
Write-Host "📦 Starting development server (HTTPS)..." -ForegroundColor Cyan
npm run dev:https
}
# If the script exits, show memory optimization tips
if ($LASTEXITCODE -ne 0) {
Write-Host "`n❌ Server crashed. Here are some optimization tips:" -ForegroundColor Red
Write-Host "1. Close other applications to free up memory" -ForegroundColor Yellow
Write-Host "2. Try running 'npm run build' to check for build errors" -ForegroundColor Yellow
Write-Host "3. Consider upgrading your system RAM if this persists" -ForegroundColor Yellow
Write-Host "4. Run 'npm update' to ensure all packages are up to date" -ForegroundColor Yellow
}