#!/bin/bash
set -e

# Change to your project directory
cd /var/www/ratemypay_dev
echo 'Pulling latest code...'
git pull origin dev

echo 'Installing PHP dependencies...'
composer install --no-dev --optimize-autoloader --no-interaction

echo 'Installing Node dependencies...'
npm ci

echo 'Building frontend...'
npm run build

echo 'Running migrations...'
php artisan migrate --force

echo 'Optimizing Laravel...'
php artisan config:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache

echo 'Dev deployment completed successfully 🎉'
