diff --git a/deploy.sh b/deploy.sh index 90cd6fd..c4e523b 100755 --- a/deploy.sh +++ b/deploy.sh @@ -203,12 +203,7 @@ setup_backend() { npm config set progress false >/dev/null 2>&1 || true npm config set loglevel warn >/dev/null 2>&1 || true # Backend braucht alle Dependencies (auch dev für Build-Tools) - timeout 600 bash -lc "npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress" || { - print_warning "npm ci ist fehlgeschlagen oder hat zu lange gedauert. Versuche fallback ohne timeout..." - npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress || { - print_error "npm ci (Backend) fehlgeschlagen"; exit 1; - } - } + npm install --no-audit --no-fund --loglevel=warn if [ ! -f .env ]; then print_warning ".env Datei nicht gefunden!" @@ -240,12 +235,7 @@ setup_frontend() { npm config set progress false >/dev/null 2>&1 || true npm config set loglevel warn >/dev/null 2>&1 || true # Frontend braucht dev-Dependencies für den Build (vite, etc.) - timeout 600 bash -lc "npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress" || { - print_warning "npm ci ist fehlgeschlagen oder hat zu lange gedauert. Versuche fallback ohne timeout..." - npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress || { - print_error "npm ci (Frontend) fehlgeschlagen"; exit 1; - } - } + npm install --no-audit --no-fund --loglevel=warn # .env.production erstellen falls nicht vorhanden if [ ! -f ".env.production" ]; then @@ -487,17 +477,27 @@ do_update() { # Backend aktualisieren print_info "Aktualisiere Backend Dependencies..." cd $BACKEND_DIR - npm config set fund false >/dev/null 2>&1 || true - npm config set audit false >/dev/null 2>&1 || true - npm config set progress false >/dev/null 2>&1 || true - npm config set loglevel warn >/dev/null 2>&1 || true - # Backend braucht alle Dependencies (auch dev für Build-Tools) - timeout 600 bash -lc "npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress" || { - print_warning "npm ci ist fehlgeschlagen oder hat zu lange gedauert. Versuche fallback ohne timeout..." - npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress || { - print_error "npm ci (Backend Update) fehlgeschlagen"; exit 1; - } - } + + # Prüfe ob package-lock.json existiert + if [ ! -f "package-lock.json" ]; then + print_warning "package-lock.json fehlt! Verwende npm install statt npm ci" + npm install --no-audit --no-fund --loglevel=warn + else + npm config set fund false >/dev/null 2>&1 || true + npm config set audit false >/dev/null 2>&1 || true + npm config set progress false >/dev/null 2>&1 || true + npm config set loglevel warn >/dev/null 2>&1 || true + + # Backend braucht alle Dependencies (auch dev für Build-Tools) + if ! npm ci --no-audit --no-fund --loglevel=warn 2>&1; then + print_warning "npm ci fehlgeschlagen. Fallback auf npm install..." + rm -rf node_modules + npm install --no-audit --no-fund --loglevel=warn || { + print_error "npm install (Backend Update) fehlgeschlagen" + exit 1 + } + fi + fi # Frontend aktualisieren print_info "Aktualisiere Frontend..." @@ -512,17 +512,26 @@ VITE_API_URL=/api EOF fi - npm config set fund false >/dev/null 2>&1 || true - npm config set audit false >/dev/null 2>&1 || true - npm config set progress false >/dev/null 2>&1 || true - npm config set loglevel warn >/dev/null 2>&1 || true - # Frontend braucht dev-Dependencies für den Build (vite, etc.) - timeout 600 bash -lc "npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress" || { - print_warning "npm ci ist fehlgeschlagen oder hat zu lange gedauert. Versuche fallback ohne timeout..." - npm ci --no-audit --no-fund --silent --loglevel=warn --no-progress || { - print_error "npm ci (Frontend Update) fehlgeschlagen"; exit 1; - } - } + # Prüfe ob package-lock.json existiert + if [ ! -f "package-lock.json" ]; then + print_warning "package-lock.json fehlt! Verwende npm install statt npm ci" + npm install --no-audit --no-fund --loglevel=warn + else + npm config set fund false >/dev/null 2>&1 || true + npm config set audit false >/dev/null 2>&1 || true + npm config set progress false >/dev/null 2>&1 || true + npm config set loglevel warn >/dev/null 2>&1 || true + + # Frontend braucht dev-Dependencies für den Build (vite, etc.) + if ! npm ci --no-audit --no-fund --loglevel=warn 2>&1; then + print_warning "npm ci fehlgeschlagen. Fallback auf npm install..." + rm -rf node_modules + npm install --no-audit --no-fund --loglevel=warn || { + print_error "npm install (Frontend Update) fehlgeschlagen" + exit 1 + } + fi + fi # Sauberer Build rm -rf dist/