42 lines
1.5 KiB
PowerShell
42 lines
1.5 KiB
PowerShell
# Script di creazione e compilazione versione per SIM da remoto --> FORZA SEMPRE step npm, senza zip!!!
|
|
|
|
# recupera timestamp x logging
|
|
function Get-TimeStamp
|
|
{
|
|
return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
|
|
}
|
|
# registra log!
|
|
function DoLog($txt2log)
|
|
{
|
|
Write-Output "$(Get-TimeStamp) $txt2log" | Out-File c:\tmp\Script.log -Append
|
|
}
|
|
|
|
|
|
Write-Output "-------------------------------- START script --------------------------------" | Out-File c:\tmp\Script.log
|
|
$StopWatch = New-Object System.Diagnostics.Stopwatch
|
|
$StopWatch.Start()
|
|
|
|
# mi sposto in wwwroot
|
|
cd wwwroot
|
|
# NPM install/build step
|
|
DoLog("START npm install")
|
|
npm install | Out-File c:\tmp\Script.log -Append
|
|
DoLog("END npm install")
|
|
|
|
DoLog("START file replace")
|
|
# replace seriate server dev (seriate.steamware.net) --> produzione (locahost)
|
|
((Get-Content -path index.html -Raw) -replace 'localhost','seriate.steamware.net') | Set-Content -Path index.html -NoNewline
|
|
((Get-Content -path config.development.json -Raw) -replace 'localhost','seriate.steamware.net') | Set-Content -Path config.development.json -NoNewline
|
|
((Get-Content -path config.production.json -Raw) -replace 'localhost','seriate.steamware.net') | Set-Content -Path config.production.json -NoNewline
|
|
|
|
# build pacchetti npm
|
|
DoLog("START npm run build ")
|
|
npm run build | Out-File c:\tmp\Script.log -Append
|
|
DoLog("END npm run build ")
|
|
|
|
# torno in folder base
|
|
cd ..
|
|
|
|
$StopWatch.Stop()
|
|
$StopWatch.Elapsed | Out-File c:\tmp\Script.log -Append
|
|
DoLog("-------------------------------- END script --------------------------------") |