Files
cfw-autumn/conductor-setup.sh
2025-10-02 14:05:17 +01:00

99 lines
2.6 KiB
Bash

#!/bin/zsh
set -e
echo "🚀 Starting Conductor workspace setup for Autumn..."
# Check for Bun
if ! command -v bun &> /dev/null; then
echo "❌ Error: Bun is not installed."
echo "Please install Bun from https://bun.sh"
exit 1
fi
echo "✅ Bun found: $(bun --version)"
# Determine root path - use CONDUCTOR_ROOT_PATH if set, otherwise use git root
if [ -n "$CONDUCTOR_ROOT_PATH" ]; then
ROOT_PATH="$CONDUCTOR_ROOT_PATH"
else
# Fallback for manual testing - go up two directories from .conductor/workspace
ROOT_PATH="$(cd "$(dirname "$0")/../.." && pwd)"
fi
echo "📂 Root path: $ROOT_PATH"
# Install dependencies
echo "📦 Installing dependencies..."
bun install
# Copy .env files from root repo
echo "📋 Copying .env files from root repository..."
if [ -f "$ROOT_PATH/server/.env" ]; then
mkdir -p server
cp "$ROOT_PATH/server/.env" server/.env
echo "✅ Copied server/.env"
else
echo "⚠️ Warning: $ROOT_PATH/server/.env not found"
fi
if [ -f "$ROOT_PATH/vite/.env" ]; then
mkdir -p vite
cp "$ROOT_PATH/vite/.env" vite/.env
echo "✅ Copied vite/.env"
else
echo "⚠️ Warning: $ROOT_PATH/vite/.env not found"
fi
if [ -f "$ROOT_PATH/shared/.env" ]; then
mkdir -p shared
cp "$ROOT_PATH/shared/.env" shared/.env
echo "✅ Copied shared/.env"
else
echo "⚠️ Warning: $ROOT_PATH/shared/.env not found"
fi
# Copy shell scripts from root
echo "📋 Copying shell scripts from root repository..."
if [ -f "$ROOT_PATH/run.sh" ]; then
cp "$ROOT_PATH/run.sh" run.sh
chmod +x run.sh
echo "✅ Copied run.sh"
else
echo "⚠️ Warning: $ROOT_PATH/run.sh not found"
fi
if [ -f "$ROOT_PATH/commands.sh" ]; then
cp "$ROOT_PATH/commands.sh" commands.sh
chmod +x commands.sh
echo "✅ Copied commands.sh"
else
echo "⚠️ Warning: $ROOT_PATH/commands.sh not found"
fi
# # Copy drizzle migration files
# if [ -d "$ROOT_PATH/shared/drizzle" ]; then
# echo "📋 Copying database migration files..."
# mkdir -p shared/drizzle
# cp -r "$ROOT_PATH/shared/drizzle/"* shared/drizzle/
# echo "✅ Copied migration files"
# fi
# Build shared workspace (required for other workspaces)
echo "🔨 Building shared workspace..."
bun -F @autumn/shared build
# # Run database migrations if DATABASE_URL exists
# if grep -q "DATABASE_URL=" server/.env 2>/dev/null; then
# echo "🗄️ Running database migrations..."
# bun db:migrate
# echo "✅ Database migrations complete"
# else
# echo "⚠️ Skipping database migrations (no DATABASE_URL found)"
# fi
echo "🎉 Workspace setup complete!"
echo ""
echo "Next: Click the 'Run' button to start the development server"