-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-release.ps1
More file actions
110 lines (94 loc) · 3.7 KB
/
Copy pathbuild-release.ps1
File metadata and controls
110 lines (94 loc) · 3.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Stage Timer Pro - Build Script for Production
# Script para compilar la versión de producción
param(
[Parameter(Position=0)]
[string]$BuildType = "release"
)
Write-Host "🏗️ Stage Timer Pro - Production Build" -ForegroundColor Cyan
Write-Host "===================================" -ForegroundColor Cyan
# Verificar Node.js
try {
$nodeVersion = node --version
Write-Host "✅ Node.js: $nodeVersion" -ForegroundColor Green
}
catch {
Write-Host "❌ Node.js no encontrado. Instalar desde https://nodejs.org/" -ForegroundColor Red
exit 1
}
# Verificar npm
try {
$npmVersion = npm --version
Write-Host "✅ npm: v$npmVersion" -ForegroundColor Green
}
catch {
Write-Host "❌ npm no encontrado" -ForegroundColor Red
exit 1
}
# Limpiar archivos anteriores
Write-Host "🧹 Limpiando archivos anteriores..." -ForegroundColor Yellow
if (Test-Path "dist") {
Remove-Item -Recurse -Force "dist"
Write-Host "✅ Carpeta dist eliminada" -ForegroundColor Green
}
if (Test-Path "src-tauri\target\release") {
Remove-Item -Recurse -Force "src-tauri\target\release"
Write-Host "✅ Target release eliminado" -ForegroundColor Green
}
# Instalar dependencias
Write-Host "📦 Verificando dependencias..." -ForegroundColor Yellow
npm ci
Write-Host "✅ Dependencias verificadas" -ForegroundColor Green
# Compilar para producción
Write-Host "🔨 Compilando Stage Timer Pro..." -ForegroundColor Yellow
Write-Host "⏱️ Esto puede tomar varios minutos..." -ForegroundColor Gray
$startTime = Get-Date
try {
npm run tauri:build
$endTime = Get-Date
$duration = $endTime - $startTime
Write-Host ""
Write-Host "🎉 ¡Compilación exitosa!" -ForegroundColor Green
Write-Host "⏱️ Tiempo total: $($duration.ToString('mm\:ss'))" -ForegroundColor Gray
Write-Host ""
# Verificar archivos generados
$msiPath = "src-tauri\target\release\bundle\msi"
$nsisPath = "src-tauri\target\release\bundle\nsis"
if (Test-Path $msiPath) {
$msiFiles = Get-ChildItem -Path $msiPath -Filter "*.msi"
foreach ($file in $msiFiles) {
$sizeInMB = [math]::Round($file.Length / 1MB, 2)
Write-Host "📦 MSI: $($file.Name) ($sizeInMB MB)" -ForegroundColor Cyan
}
}
if (Test-Path $nsisPath) {
$nsisFiles = Get-ChildItem -Path $nsisPath -Filter "*.exe"
foreach ($file in $nsisFiles) {
$sizeInMB = [math]::Round($file.Length / 1MB, 2)
Write-Host "📦 NSIS: $($file.Name) ($sizeInMB MB)" -ForegroundColor Cyan
}
}
Write-Host ""
Write-Host "📁 Archivos generados en:" -ForegroundColor Yellow
Write-Host " • $msiPath" -ForegroundColor White
Write-Host " • $nsisPath" -ForegroundColor White
Write-Host ""
Write-Host "🚀 ¡Listo para distribución!" -ForegroundColor Green
# Abrir carpeta de destino
$response = Read-Host "¿Abrir carpeta de archivos? (y/n)"
if ($response -eq "y" -or $response -eq "Y") {
Start-Process "explorer.exe" -ArgumentList "src-tauri\target\release\bundle"
}
}
catch {
Write-Host ""
Write-Host "❌ Error durante la compilación:" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
Write-Host ""
Write-Host "🔧 Posibles soluciones:" -ForegroundColor Yellow
Write-Host " • Verificar que Visual Studio Build Tools esté instalado" -ForegroundColor White
Write-Host " • Ejecutar 'npm install' para reinstalar dependencias" -ForegroundColor White
Write-Host " • Verificar que no haya otros procesos usando los archivos" -ForegroundColor White
exit 1
}
Write-Host ""
Write-Host "✨ Proceso completado exitosamente" -ForegroundColor Green