From 06abcb65cb01d44cc6f977cc67ba31dfb352c64c Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 8 Jul 2020 10:17:24 +0200 Subject: [PATCH] update script: 7zip (faster) + fix trim file end --- Thermo.Active/makeTestVersion.ps1 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Thermo.Active/makeTestVersion.ps1 b/Thermo.Active/makeTestVersion.ps1 index 598795dc..6611dce5 100644 --- a/Thermo.Active/makeTestVersion.ps1 +++ b/Thermo.Active/makeTestVersion.ps1 @@ -1,5 +1,9 @@ # Script di creazione e compilazione versione per test in macchina +# Prerequisito: da administrator --> installare 7zip cmdlet (rif https://www.sans.org/blog/powershell-7-zip-module-versus-compress-archive-with-encryption/) +# Install-Module -Name 7Zip4Powershell + + # Check parameters Param ( [Parameter(Mandatory=$True)] @@ -43,9 +47,9 @@ if($npmBuild -eq "y") { DoLog("START file replace") # replace seriate server dev (seriate.steamware.net) --> produzione (locahost) - ((Get-Content -path index.html -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path index.html - ((Get-Content -path config.development.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.development.json - ((Get-Content -path config.production.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.production.json + ((Get-Content -path index.html -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path index.html -NoNewline + ((Get-Content -path config.development.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.development.json -NoNewline + ((Get-Content -path config.production.json -Raw) -replace 'seriate.steamware.net','localhost') | Set-Content -Path config.production.json -NoNewline # build pacchetti npm DoLog("START npm run build ") @@ -65,9 +69,10 @@ DoLog("END copy step") # Compression step DoLog("START ZIP step") -$ProgressPreference = "SilentlyContinue" -Compress-Archive -CompressionLevel Fastest -Force -Path C:\Users\samuele\Desktop\ThermoActive -DestinationPath "C:\Users\samuele\Desktop\ThermoActive_$version.zip" | Out-File c:\tmp\Script.log -Append -$ProgressPreference = "Continue" +Compress-7Zip -Path C:\Users\samuele\Desktop\ThermoActive -ArchiveFileName "C:\Users\samuele\Desktop\ThermoActive_7zip.zip" -Format Zip +#$ProgressPreference = "SilentlyContinue" +#Compress-Archive -CompressionLevel Fastest -Force -Path C:\Users\samuele\Desktop\ThermoActive -DestinationPath "C:\Users\samuele\Desktop\ThermoActive_$version.zip" | Out-File c:\tmp\Script.log -Append +#$ProgressPreference = "Continue" DoLog("END ZIP step") $StopWatch.Stop()