From 9264854a547a95af8ec36d40c095fd3f7322afcb Mon Sep 17 00:00:00 2001 From: syoul Date: Tue, 9 Dec 2025 14:41:57 +0100 Subject: [PATCH] build: supprimer heredoc des scripts team MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Déplace add_team_link.py et add_team_link.sh dans docker/ - Remplace les heredocs par des COPY dans Dockerfile.business - Évite l'erreur de parsing 'unknown instruction: import' Compatibilité Portainer sans syntaxe heredoc. --- Dockerfile.business | 298 +--------------------------------------- docker/add_team_link.py | 195 ++++++++++++++++++++++++++ docker/add_team_link.sh | 97 +++++++++++++ 3 files changed, 294 insertions(+), 296 deletions(-) create mode 100644 docker/add_team_link.py create mode 100644 docker/add_team_link.sh diff --git a/Dockerfile.business b/Dockerfile.business index 31820ec..dccf9e3 100644 --- a/Dockerfile.business +++ b/Dockerfile.business @@ -104,304 +104,10 @@ RUN mkdir -p .techradar/src/pages COPY docker/team-page.tsx .techradar/src/pages/team.tsx # Script Python pour ajouter le lien Équipe dans Navigation.tsx (supprime TOUS les doublons) -RUN cat > /tmp/add_team_link.py << 'PYEOF' -#!/usr/bin/env python3 -import sys -import re -import os - -f = ".techradar/src/components/Navigation/Navigation.tsx" - -try: - # Vérifier que le fichier existe - if not os.path.exists(f): - print(f"❌ Fichier {f} introuvable", file=sys.stderr) - sys.exit(1) - - with open(f, 'r', encoding='utf-8') as file: - content = file.read() - - # VÉRIFICATION PRÉLIMINAIRE: Détecter les doublons structurels - print("🔍 Vérification de la structure du composant...") - - # Compter les éléments structurels - nav_patterns = [ - r']*>', content)) - - # Compter les logos (Image avec logo ou logoFile) - logo_patterns = [ - r'logoFile', - r'logo\.svg', - r'[Ll]ogo', - r'Image.*logo' - ] - logo_count = sum(len(re.findall(pattern, content)) for pattern in logo_patterns) - - # Compter les fonctions Navigation - function_count = len(re.findall(r'(export\s+(default\s+)?function\s+Navigation|const\s+Navigation\s*=\s*\(|function\s+Navigation\s*\()', content)) - - print(f"📊 Structure détectée: {nav_count} nav, {ul_count} ul, {logo_count} logo, {function_count} fonction(s)") - - # Détecter les duplications structurelles - if function_count > 1: - print(f"⚠️ ATTENTION: {function_count} fonction(s) Navigation détectée(s) - possible duplication du composant", file=sys.stderr) - # Extraire uniquement la première fonction Navigation - matches = list(re.finditer(r'(export\s+(default\s+)?function\s+Navigation|const\s+Navigation\s*=\s*\(|function\s+Navigation\s*\()', content)) - if len(matches) > 1: - # Garder seulement jusqu'à la fin de la première fonction - first_end = matches[1].start() if len(matches) > 1 else len(content) - content = content[:first_end] - # Trouver la fin de la fonction (dernière accolade fermante avant la prochaine fonction) - brace_count = 0 - in_function = False - for i, char in enumerate(content[matches[0].start():], matches[0].start()): - if char == '{': - brace_count += 1 - in_function = True - elif char == '}': - brace_count -= 1 - if in_function and brace_count == 0: - content = content[:i+1] - break - print(f"✅ Duplication du composant supprimée") - - if ul_count > 3: # Plus de 3 ul suggère une duplication - print(f"⚠️ ATTENTION: {ul_count} éléments