#!/bin/bash

# Set default APP_URL
DEFAULT_APP_URL="https://memefa.st"

# Check if app_url parameter is provided
if [ $# -eq 0 ]; then
    APP_URL=$DEFAULT_APP_URL
    echo "Using default APP_URL: $APP_URL"
else
    APP_URL=$1
    echo "Using provided APP_URL: $APP_URL"
fi

# Run commands with the determined APP_URL
eval "APP_URL=$APP_URL php artisan ziggy:generate"
eval "blade-formatter --write resources/**/*.blade.php"
eval "./vendor/bin/pint"
eval "find . -name '.DS_Store' -type f -exec rm {} +"
eval "APP_ENV=production APP_URL=$APP_URL npm run build"
