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:
Matthew Raymer
2025-08-01 05:47:43 +00:00
parent 8b2c6714ec
commit c30b94dcc7
9 changed files with 53 additions and 15 deletions

View File

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