forked from trent_larson/crowd-funder-for-time-pwa
Integrate TypeScript type checking into build process with conditional execution
- Add type checking to build scripts for production/test builds only - Fix TypeScript errors in migration service, router, and platform services - Add electronAPI type declarations for Electron platform - Remove type checking from development builds for faster hot reload - Update tsconfig.node.json to resolve configuration conflicts - Ensure type safety for production while maintaining fast development workflow
This commit is contained in:
@@ -252,6 +252,25 @@ execute_docker_build() {
|
||||
log_info "Docker image available as: $image_tag:$mode"
|
||||
}
|
||||
|
||||
# Function to run type checking based on build mode
|
||||
run_type_checking() {
|
||||
local mode="$1"
|
||||
|
||||
# Only run type checking for production and test builds
|
||||
if [ "$mode" = "production" ] || [ "$mode" = "test" ]; then
|
||||
log_info "Running TypeScript type checking for $mode mode..."
|
||||
|
||||
if ! measure_time npm run type-check; then
|
||||
log_error "TypeScript type checking failed for $mode mode!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
log_success "TypeScript type checking completed for $mode mode"
|
||||
else
|
||||
log_debug "Skipping TypeScript type checking for development mode"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to start Vite development server
|
||||
start_dev_server() {
|
||||
log_info "Starting Vite development server..."
|
||||
@@ -333,7 +352,10 @@ elif [ "$SERVE_BUILD" = true ]; then
|
||||
log_info "Cleaning dist directory..."
|
||||
clean_build_artifacts "dist"
|
||||
|
||||
# Step 2: Execute Vite build
|
||||
# Step 2: Run type checking (for production/test builds)
|
||||
safe_execute "Type checking for $BUILD_MODE mode" "run_type_checking $BUILD_MODE" || exit 2
|
||||
|
||||
# Step 3: Execute Vite build
|
||||
safe_execute "Vite build for $BUILD_MODE mode" "execute_vite_build $BUILD_MODE" || exit 3
|
||||
|
||||
# Step 3: Serve the build
|
||||
@@ -348,7 +370,10 @@ else
|
||||
log_info "Cleaning dist directory..."
|
||||
clean_build_artifacts "dist"
|
||||
|
||||
# Step 2: Execute Vite build
|
||||
# Step 2: Run type checking (for production/test builds)
|
||||
safe_execute "Type checking for $BUILD_MODE mode" "run_type_checking $BUILD_MODE" || exit 2
|
||||
|
||||
# Step 3: Execute Vite build
|
||||
safe_execute "Vite build for $BUILD_MODE mode" "execute_vite_build $BUILD_MODE" || exit 3
|
||||
|
||||
# Step 3: Execute Docker build if requested
|
||||
|
||||
Reference in New Issue
Block a user