diff --git a/server/scripts/update.ps1 b/server/scripts/update.ps1 index 5083393..845a18f 100644 --- a/server/scripts/update.ps1 +++ b/server/scripts/update.ps1 @@ -85,6 +85,9 @@ $plantFunness = { $localPath = $location -replace '\$', ':' $serverFile = "$($localPath)\$buildFile" $serverPath = "$($localPath)" + $appPath = $extractedFolderPath + $nssmPath = $serverPath + "\nssm.exe" + $npmPath = "C:\Program Files\nodejs\npm.cmd" # Path to npm.cmd Write-Host "In the plant we go!!!!!" @@ -92,26 +95,12 @@ $plantFunness = { ###################################################################################### # Removing the fist and frontend folder to make sure we keep them the same and clean. ###################################################################################### - try { - # Delete the directories after extraction - Write-Host "Deleting Dist and Frontend..." - - $distPath = "$serverPath\dist\" - $frontendPath = "$serverPath\frontend\" - if (Test-Path $distPath) { - Remove-Item -Path $distPath -Recurse -Force - - } - - if (Test-Path $frontendPath) { - Remove-Item -Path $frontendPath -Recurse -Force - } - - } catch { - Write-Host "Error: $_" - exit 1 # Exit with a non-zero code if there's an error - } + # Delete the directories after extraction + Write-Host "Deleting Dist and Frontend..." + + Set-Location $serverPath + npm run removeOld # --omit=dev Write-Host "Unzipping the folder..." @@ -188,10 +177,6 @@ $plantFunness = { # Service removoal and making sure we have the new version added ################################################################# - $appPath = $extractedFolderPath - $nssmPath = $serverPath + "\nssm.exe" - $npmPath = "C:\Program Files\nodejs\npm.cmd" # Path to npm.cmd - ################################################################# # Removing all the old services #################################################################