From 56f227e93950a4a9da8d2d190c6993e471453ddf Mon Sep 17 00:00:00 2001 From: syoul Date: Sun, 7 Dec 2025 08:15:08 +0100 Subject: [PATCH] fix: simplification modification Navigation.tsx avec sed + Python inline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Utilisation de sed en premier (plus simple) - Fallback avec Python en une seule ligne si sed échoue - Pas de heredoc complexe qui cause des problèmes d'échappement --- Dockerfile.business | 51 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 44 deletions(-) diff --git a/Dockerfile.business b/Dockerfile.business index 330b03f..582768e 100644 --- a/Dockerfile.business +++ b/Dockerfile.business @@ -110,50 +110,13 @@ RUN echo "✅ Page team.tsx créée" # Modifier Navigation.tsx pour ajouter le lien Équipe RUN if ! grep -q 'href="/team"' .techradar/src/components/Navigation/Navigation.tsx; then \ echo "➕ Ajout du lien Équipe dans Navigation.tsx..." && \ - python3 << 'PYTHON_EOF' -import re - -nav_file = ".techradar/src/components/Navigation/Navigation.tsx" -with open(nav_file, 'r') as f: - content = f.read() - -# Trouver la fin du lien Overview et insérer le nouveau lien avant le commentaire -pattern = r'(\s*\s*)(\{/\*)' -replacement = r'\1
  • \n \n 👥 Équipe\n \n
  • \n \2' - -new_content = re.sub(pattern, replacement, content) - -if new_content != content: - with open(nav_file, 'w') as f: - f.write(new_content) - print("✅ Navigation.tsx modifié avec succès") -else: - print("⚠️ Pattern non trouvé, tentative alternative...") - # Alternative: insérer après la ligne avec de overview - lines = content.split('\n') - for i, line in enumerate(lines): - if 'href="/overview"' in line: - # Trouver la ligne qui suit - for j in range(i, min(i+10, len(lines))): - if '' in lines[j] and j+1 < len(lines) and '' in lines[j+1]: - # Insérer après - new_lines = lines[:j+2] + [ - '
  • ', - ' ', - ' 👥 Équipe', - ' ', - '
  • ' - ] + lines[j+2:] - with open(nav_file, 'w') as f: - f.write('\n'.join(new_lines)) - print("✅ Navigation.tsx modifié avec succès (méthode alternative)") - break - break - else: - print("❌ Impossible de modifier Navigation.tsx") - exit(1) -PYTHON_EOF -RUN grep -q 'href="/team"' .techradar/src/components/Navigation/Navigation.tsx && echo "✅ Lien Équipe ajouté" || (echo "❌ Lien Équipe non trouvé après modification" && cat .techradar/src/components/Navigation/Navigation.tsx && exit 1) + sed -i '/href="\/overview"/,/<\/Link>/ { /<\/Link>/a\
  • \ \ 👥 Équipe\ \
  • }' .techradar/src/components/Navigation/Navigation.tsx && \ + grep -q 'href="/team"' .techradar/src/components/Navigation/Navigation.tsx && echo "✅ Lien Équipe ajouté" || (echo "❌ Lien Équipe non trouvé après modification avec sed, tentative avec Python..." && \ + python3 -c "import re; content = open('.techradar/src/components/Navigation/Navigation.tsx').read(); lines = content.split('\n'); insert_idx = -1; [setattr(locals(), 'insert_idx', j+2) or None for i, line in enumerate(lines) if 'href=\"/overview\"' in line for j in range(i, min(i+10, len(lines))) if '' in lines[j] and j+1 < len(lines) and '' in lines[j+1]]; new_lines = lines[:insert_idx] + ['
  • ', ' ', ' 👥 Équipe', ' ', '
  • '] + lines[insert_idx:] if insert_idx > 0 else lines; open('.techradar/src/components/Navigation/Navigation.tsx', 'w').write('\n'.join(new_lines)) if insert_idx > 0 else None; print('✅ Navigation.tsx modifié' if insert_idx > 0 else '❌ Échec')" && \ + grep -q 'href="/team"' .techradar/src/components/Navigation/Navigation.tsx && echo "✅ Lien Équipe ajouté avec Python" || (echo "❌ Lien Équipe toujours non trouvé" && cat .techradar/src/components/Navigation/Navigation.tsx && exit 1)); \ + else \ + echo "ℹ️ Lien Équipe déjà présent dans Navigation.tsx"; \ + fi # Builder l'application en mode production pour éviter Fast Refresh # Utiliser WORKDIR pour changer de répertoire de manière fiable