From b4909d25ce7943135c2ba808615a2799c3157b51 Mon Sep 17 00:00:00 2001 From: John Simons Date: Wed, 25 Mar 2026 09:49:36 +1000 Subject: [PATCH] Improve build script error detection and remove redundant file Update the build script to check $LASTEXITCODE after each npm command, ensuring that failures during installation, linting, or building are correctly reported. Additionally, remove the unused build.ps1 script in the ServicePulse directory. --- src/ServicePulse.Host/build.ps1 | 17 ++++++++--------- src/ServicePulse/build.ps1 | 11 ----------- 2 files changed, 8 insertions(+), 20 deletions(-) delete mode 100644 src/ServicePulse/build.ps1 diff --git a/src/ServicePulse.Host/build.ps1 b/src/ServicePulse.Host/build.ps1 index 15d8fcd706..03a67b9575 100644 --- a/src/ServicePulse.Host/build.ps1 +++ b/src/ServicePulse.Host/build.ps1 @@ -7,22 +7,21 @@ if (Test-Path $AppOutputFolder) { } New-Item -ItemType Directory -Force -Path $AppOutputFolder - Push-Location $FrontendSourceFolder -npm audit --audit-level=low --omit=dev -if ( $? -eq $false ) { - exit $LastExitCode -} +npm audit --audit-level=low --omit=dev +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } npm install +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + npm run lint +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + npm run build +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + Remove-Item -Path "./dist/mockServiceWorker.js" -ErrorAction SilentlyContinue Pop-Location Copy-Item -path $FrontendSourceFolder/dist/* -Destination $AppOutputFolder -Recurse - -if ( $? -eq $false ) { - exit $LastExitCode -} diff --git a/src/ServicePulse/build.ps1 b/src/ServicePulse/build.ps1 deleted file mode 100644 index 6817b0c91b..0000000000 --- a/src/ServicePulse/build.ps1 +++ /dev/null @@ -1,11 +0,0 @@ -$ScriptPath = $PSCommandPath | Split-Path -$FrontendSourceFolder = $ScriptPath + "/../Frontend" - -Push-Location $FrontendSourceFolder -npm install -npm run build -Pop-Location - -if ( $? -eq $false ) { - exit $LastExitCode -} \ No newline at end of file