Something went wrong. Try again.
WIP experiment with 95% vibe coding
Something went wrong. Try again.
tiny-workshop dev.sh
3.9 kB ยท 143 lines
Shell
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144#!/bin/bash# Tiny Workshop - Development Runner# Builds backend and runs the full application
set -e # Exit on error
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"cd "$SCRIPT_DIR"
echo "๐ง Tiny Workshop Dev Runner"echo "=========================="echo ""
# Colors for pretty outputRED='\033[0;31m'GREEN='\033[0;32m'YELLOW='\033[1;33m'BLUE='\033[0;34m'NC='\033[0m' # No Color
# Parse argumentsBUILD_BACKEND=trueBUILD_RUST=trueRUN=trueDEBUG_SERVER=false
while [[ $# -gt 0 ]]; do case $1 in --skip-backend) BUILD_BACKEND=false shift ;; --skip-rust) BUILD_RUST=false shift ;; --build-only) RUN=false shift ;; --debug-server) DEBUG_SERVER=true shift ;; --help|-h) echo "Usage: ./dev.sh [options]" echo "" echo "Options:" echo " --skip-backend Skip building the backend executable" echo " --skip-rust Skip building the Rust frontend" echo " --build-only Build everything but don't run" echo " --debug-server Enable debug HTTP server (port 8765)" echo " --help, -h Show this help message" exit 0 ;; *) echo -e "${RED}Unknown option: $1${NC}" exit 1 ;; esacdone
# Step 1: Build backendif [ "$BUILD_BACKEND" = true ]; then echo -e "${BLUE}[1/3]${NC} Building backend standalone executable..."
# Check if bun is installed if ! command -v bun &> /dev/null; then echo -e "${RED}Error: bun is not installed or not in PATH${NC}" echo "Install bun: https://bun.sh" exit 1 fi
# Install dependencies if needed if [ ! -d "backend/node_modules" ]; then echo " Installing backend dependencies..." cd backend pnpm install cd .. fi
# Build the standalone executable echo " Compiling TypeScript to standalone exe..." cd backend/packages/adapter bun run build cd ../../..
echo -e "${GREEN} โ Backend built: backend/packages/adapter/dist/tiny-workshop-backend.exe${NC}"else echo -e "${YELLOW}[1/3]${NC} Skipping backend build"fi
echo ""
# Step 2: Build Rust frontendif [ "$BUILD_RUST" = true ]; then echo -e "${BLUE}[2/3]${NC} Building Rust frontend..."
cd tiny-workshop if [ "$DEBUG_SERVER" = true ]; then echo " Building with debug server enabled..." cargo build --package executor --features debug_server else cargo build --package executor fi cd ..
echo -e "${GREEN} โ Rust frontend built${NC}"else echo -e "${YELLOW}[2/3]${NC} Skipping Rust build"fi
echo ""
# Step 3: Run the applicationif [ "$RUN" = true ]; then echo -e "${BLUE}[3/3]${NC} Starting Tiny Workshop..."
# Clear old log file LOG_FILE="tiny-workshop/tiny-workshop.log" if [ -f "$LOG_FILE" ]; then rm "$LOG_FILE" echo " Cleared old log file" fi
echo "" echo -e "${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}" echo -e "${GREEN} Tiny Workshop is starting up!${NC}" if [ "$DEBUG_SERVER" = true ]; then echo -e "${GREEN} Debug server: http://localhost:8765${NC}" fi echo -e "${GREEN}โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ${NC}" echo ""
cd tiny-workshop if [ "$DEBUG_SERVER" = true ]; then cargo run --package executor --features debug_server else cargo run --package executor fielse echo -e "${YELLOW}[3/3]${NC} Build complete! Run with: cd tiny-workshop && cargo run --package executor"fi