refactor(lst): added in a removal of old files so we can keep the server clean

This commit is contained in:
2025-03-30 08:41:26 -05:00
parent a48d4bd5af
commit c27ad7cf6a

View File

@@ -85,6 +85,9 @@ $plantFunness = {
$localPath = $location -replace '\$', ':' $localPath = $location -replace '\$', ':'
$serverFile = "$($localPath)\$buildFile" $serverFile = "$($localPath)\$buildFile"
$serverPath = "$($localPath)" $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!!!!!" 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. # 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) { # Delete the directories after extraction
Remove-Item -Path $distPath -Recurse -Force Write-Host "Deleting Dist and Frontend..."
} Set-Location $serverPath
npm run removeOld # --omit=dev
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
}
Write-Host "Unzipping the folder..." Write-Host "Unzipping the folder..."
@@ -188,10 +177,6 @@ $plantFunness = {
# Service removoal and making sure we have the new version added # 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 # Removing all the old services
################################################################# #################################################################