-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatchreact.ps1
More file actions
39 lines (31 loc) · 1.59 KB
/
watchreact.ps1
File metadata and controls
39 lines (31 loc) · 1.59 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
# Void Development Environment Startup Script
# Purpose: Configure Node.js environment, start watch modes, and launch Void app
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Void Dev Environment Startup" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: Configure fnm environment
Write-Host "[1/4] Configuring fnm environment..." -ForegroundColor Yellow
fnm env --use-on-cd | Out-String | Invoke-Expression
if ($LASTEXITCODE -ne 0) {
Write-Host "Error: fnm environment configuration failed" -ForegroundColor Red
exit 1
}
Write-Host "Success: fnm environment configured" -ForegroundColor Green
Write-Host ""
# Step 2: Switch to specified Node.js version
Write-Host "[2/4] Switching to Node.js v20.18.2..." -ForegroundColor Yellow
fnm use 20.18.2
if ($LASTEXITCODE -ne 0) {
Write-Host "Error: Node.js version switch failed" -ForegroundColor Red
exit 1
}
# Verify Node.js version
$nodeVersion = node --version
Write-Host "Success: Current Node.js version: $nodeVersion" -ForegroundColor Green
Write-Host ""
# Start watchreact (React compilation) in new window
Write-Host "Starting React watch (npm run watchreact)..." -ForegroundColor Cyan
Start-Process powershell -ArgumentList "-NoExit", "-Command", "fnm env --use-on-cd | Out-String | Invoke-Expression; fnm use 20.18.2; Write-Host 'React Watch Mode' -ForegroundColor Green; Write-Host '================================' -ForegroundColor Cyan; Write-Host ''; npm run watchreact" -WindowStyle Normal
Start-Sleep -Seconds 2
./scripts/code.bat