-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.ps1
More file actions
56 lines (51 loc) · 1.7 KB
/
Copy pathstart.ps1
File metadata and controls
56 lines (51 loc) · 1.7 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Write-Host "========================================"
Write-Host " BlackboardChina Downloader Launcher"
Write-Host "========================================"
Write-Host ""
Set-Location -Path $PSScriptRoot
try {
$nodeVersion = node --version
Write-Host "[INFO] Node.js detected: $nodeVersion"
} catch {
Write-Host "[ERROR] Node.js is not installed." -ForegroundColor Red
Write-Host "Install Node.js 20.x or 22.x LTS from https://nodejs.org/"
Read-Host "Press Enter to exit"
exit 1
}
try {
$npmVersion = npm --version
Write-Host "[INFO] npm detected: $npmVersion"
} catch {
Write-Host "[ERROR] npm is not available." -ForegroundColor Red
Write-Host "Reinstall Node.js from https://nodejs.org/"
Read-Host "Press Enter to exit"
exit 1
}
Write-Host "[INFO] Running bootstrap..."
npm run bootstrap
if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host "[ERROR] Bootstrap failed. Please follow the on-screen next step." -ForegroundColor Red
Read-Host "Press Enter to exit"
exit 1
}
Write-Host "[INFO] Checking configuration..."
node dist\cli.js config-check --quiet *> $null
if ($LASTEXITCODE -ne 0) {
Write-Host "[INFO] Setup is missing or invalid. Launching setup wizard..." -ForegroundColor Yellow
node dist\cli.js setup
if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host "[ERROR] Setup failed." -ForegroundColor Red
Read-Host "Press Enter to exit"
exit 1
}
}
Write-Host "[INFO] Starting downloader..." -ForegroundColor Green
node dist\cli.js download
if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host "[ERROR] The application encountered an error." -ForegroundColor Red
Read-Host "Press Enter to exit"
exit 1
}