Browse Source

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.
get-get-hash
Matthew Raymer 7 days ago
parent
commit
c27caf8887
  1. 16
      scripts/common.sh

16
scripts/common.sh

@ -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

Loading…
Cancel
Save