From c27caf88872ac7809b825dbdbbd04674b51046eb Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 6 Aug 2025 03:10:17 +0000 Subject: [PATCH] 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. --- scripts/common.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index ac06e315..eb5956b6 100755 --- a/scripts/common.sh +++ b/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