#!/bin/bash # Build and install the new libraries # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' CYAN='\033[0;36m' NC='\033[0m' # No Color echo -e "${CYAN}Building and installing new libraries...${NC}" # Store original location ORIGINAL_DIR=$(pwd) cd "/home/boki/stock-bot" cleanup() { cd "$ORIGINAL_DIR" } # Set up cleanup on exit trap cleanup EXIT # Build order is important due to dependencies libs=( "types" # Base types - no dependencies "config" # Configuration - depends on types "logger" # Logging utilities - depends on types "utils" # Utilities - depends on types and config # Database clients "postgres-client" # PostgreSQL client - depends on types, config, logger # "mongodb-client" # MongoDB client - depends on types, config, logger (temporarily disabled - needs zod->yup conversion) "questdb-client" # QuestDB client - depends on types, config, logger # Service libraries "cache" # Cache - depends on types and logger "http" # HTTP client - depends on types, config, logger "event-bus" # Event bus - depends on types, logger "shutdown" # Shutdown - depends on types, logger # Engine libraries "data-frame" # Data frame - depends on types, utils "vector-engine" # Vector engine - depends on types, utils, data-frame "strategy-engine" # Strategy engine - depends on types, utils, event-bus ) # Build each library in order for lib in "${libs[@]}"; do lib_path="/home/boki/stock-bot/libs/$lib" echo -e "${GREEN}Building $lib...${NC}" cd "$lib_path" bun run build if [ $? -ne 0 ]; then echo -e "${RED}Failed to build $lib. Exiting.${NC}" exit 1 fi done echo -e "${GREEN}All libraries built successfully!${NC}" cd "/home/boki/stock-bot"