dd-timer/build.ps1

72 lines
2.2 KiB
PowerShell
Executable File

# Minuteur Dragodinde - Script de construction
$ErrorActionPreference = 'Stop'
$Host.UI.RawUI.WindowTitle = 'Minuteur Dragodinde - Construction'
Write-Host ''
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ' MINUTEUR DRAGODINDE - Construction du .exe' -ForegroundColor Cyan
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ''
Set-Location $PSScriptRoot
# Verification Node.js
try {
$nodeVer = node -v 2>&1
Write-Host "[OK] Node.js : $nodeVer" -ForegroundColor Green
} catch {
Write-Host '[ERREUR] Node.js introuvable. Installez depuis https://nodejs.org' -ForegroundColor Red
Start-Process 'https://nodejs.org'
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
# Verification npm
try {
$npmVer = npm -v 2>&1
Write-Host "[OK] npm : $npmVer" -ForegroundColor Green
} catch {
Write-Host '[ERREUR] npm introuvable.' -ForegroundColor Red
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
Write-Host ''
Write-Host '[1/3] Installation des dependances (~150 Mo, premiere fois)...' -ForegroundColor Yellow
Write-Host ''
npm install
if ($LASTEXITCODE -ne 0) {
Write-Host '[ERREUR] npm install a echoue.' -ForegroundColor Red
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
Write-Host ''
Write-Host '[OK] Dependances installees' -ForegroundColor Green
Write-Host ''
Write-Host '[2/3] Construction du logiciel Windows (2-5 minutes)...' -ForegroundColor Yellow
Write-Host ''
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host '[ERREUR] Build echoue - voir messages ci-dessus.' -ForegroundColor Red
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
Write-Host ''
Write-Host '[3/3] Termine !' -ForegroundColor Green
Write-Host ''
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ' Installeur pret dans le dossier dist' -ForegroundColor Cyan
Write-Host ' Minuteur Dragodinde Setup 1.0.0.exe' -ForegroundColor Cyan
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ''
if (Test-Path 'dist') {
Invoke-Item 'dist'
}
Read-Host 'Appuyez sur Entree pour fermer'