Fix build script to fail on TypeScript errors

Update measure_time function to properly handle command exit codes:
- Check command success/failure and return appropriate exit code
- Log failure messages with timing and exit code information
- Ensure TypeScript type checking failures stop the build process
- Maintains timing logs for both success and failure cases

This prevents deployment of code with TypeScript type errors by making
test and production builds fail fast when tsc --noEmit reports issues.
This commit is contained in:
Matthew Raymer
2025-08-06 03:10:17 +00:00
parent b17642fbcb
commit c27caf8887

View File

@@ -51,10 +51,18 @@ log_step() {
# Function to measure and log execution time
measure_time() {
local start_time=$(date +%s)
"$@"
local end_time=$(date +%s)
local duration=$((end_time - start_time))
log_success "Completed in ${duration} seconds"
if "$@"; then
local end_time=$(date +%s)
local duration=$((end_time - start_time))
log_success "Completed in ${duration} seconds"
return 0
else
local exit_code=$?
local end_time=$(date +%s)
local duration=$((end_time - start_time))
log_error "Failed after ${duration} seconds (exit code: ${exit_code})"
return $exit_code
fi
}
# Function to print section headers