#!/bin/bash # Frontend-Installationsskript für Torbens Version # Installiert und konfiguriert das Frontend auf der Basis von Torbens Code set -e # Beende das Skript bei Fehlern SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" FRONTEND_DIR="$SCRIPT_DIR/reservation-platform" LOG_FILE="$SCRIPT_DIR/frontend-install.log" # Logfunktion log() { echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE" } # Lösche Log-Datei, falls vorhanden > "$LOG_FILE" log "Beginne Installation des Torben-Frontends" # Überprüfe, ob das Verzeichnis existiert if [ ! -d "$FRONTEND_DIR" ]; then log "FEHLER: Das Frontend-Verzeichnis existiert nicht. Führe zuerst restore-torben-frontend.sh aus." exit 1 fi # Wechsle ins Frontend-Verzeichnis cd "$FRONTEND_DIR" log "Arbeite im Verzeichnis: $FRONTEND_DIR" # Erstelle .env-Datei, falls sie nicht existiert if [ ! -f ".env" ]; then log "Erstelle .env-Datei aus .env.example" if [ -f ".env.example" ]; then cp .env.example .env # Setze Backend-URL für lokale Entwicklung echo "# Konfiguriert für lokales Backend" >> .env echo "NEXT_PUBLIC_API_URL=http://localhost:5000" >> .env log ".env-Datei erstellt und konfiguriert" else log "WARNUNG: .env.example nicht gefunden, erstelle minimale .env" echo "NEXT_PUBLIC_API_URL=http://localhost:5000" > .env fi fi # Installiere Abhängigkeiten log "Installiere Frontend-Abhängigkeiten mit pnpm" if command -v pnpm &> /dev/null; then pnpm install 2>&1 | tee -a "$LOG_FILE" else log "FEHLER: pnpm ist nicht installiert. Bitte installiere pnpm mit 'npm install -g pnpm'" exit 1 fi # Baue das Projekt, um zu prüfen, ob alles funktioniert log "Baue das Frontend, um die Installation zu verifizieren" pnpm build 2>&1 | tee -a "$LOG_FILE" log "Installation abgeschlossen!" log "" log "Starte das Frontend mit: cd $FRONTEND_DIR && pnpm dev" log "Das Frontend wird dann verfügbar sein unter: http://localhost:3000" log "" log "Stelle sicher, dass das Backend läuft mit: cd $SCRIPT_DIR/../backend && source venv/bin/activate && python app.py"