#!/usr/bin/env bash

set -euo pipefail

ENV_FILE=".env"

if grep -q '^APP_ENV=' "$ENV_FILE"; then
  # Unterschiedliche sed-Varianten behandeln
  if sed --version >/dev/null 2>&1; then
    # GNU sed
    sed -i 's/^APP_ENV=.*/APP_ENV=dev/' "$ENV_FILE"
  else
    # BSD sed (macOS)
    sed -i '' 's/^APP_ENV=.*/APP_ENV=dev/' "$ENV_FILE"
  fi
else
  echo "APP_ENV=dev" >> "$ENV_FILE"
fi

rm -rf ./public/assets/
php bin/console cache:clear
php bin/console asset-map:compile
php bin/console tailwind:build
