#!/usr/bin/env bash
set -e

echo "=== Indian Books Worldwide: Setting up Development Environment ==="

# Check for .env file
if [ ! -f .env ]; then
    echo "Creating .env from .env.example..."
    cp .env.example .env
else
    echo ".env file already exists."
fi

# Install root dependencies and workspaces
echo "Installing Node.js dependencies..."
npm install

# Build shared package first
echo "Building shared packages..."
npm run build --workspace=packages/shared

echo "=== Setup completed successfully! ==="
