fix: modification directe dans Dockerfile sans script séparé
- Création de team.tsx directement dans le Dockerfile - Modification de Navigation.tsx avec Python inline - Méthode alternative si le pattern regex ne fonctionne pas - Plus simple et plus fiable que d'utiliser un script séparé
This commit is contained in:
@@ -74,21 +74,89 @@ RUN mkdir -p .techradar/data && \
|
||||
echo "📁 Vérification que team.html existe dans public/ source:" && \
|
||||
test -f public/team.html && echo "✅ public/team.html existe" || echo "❌ public/team.html n'existe pas"
|
||||
|
||||
# Créer la page Next.js /team et modifier Navigation
|
||||
RUN chmod +x scripts/create-team-page.sh && \
|
||||
echo "🚀 Exécution de create-team-page.sh..." && \
|
||||
echo "📋 Vérification que Navigation.tsx existe:" && \
|
||||
test -f .techradar/src/components/Navigation/Navigation.tsx && echo "✅ Navigation.tsx existe" || (echo "❌ Navigation.tsx n'existe pas" && ls -la .techradar/src/components/Navigation/ 2>/dev/null && exit 1) && \
|
||||
echo "📋 État de Navigation.tsx AVANT modification:" && \
|
||||
grep -A 3 'href="/overview"' .techradar/src/components/Navigation/Navigation.tsx || echo "Pattern overview non trouvé" && \
|
||||
echo "" && \
|
||||
./scripts/create-team-page.sh || (echo "❌ Script create-team-page.sh a échoué" && cat .techradar/src/components/Navigation/Navigation.tsx && exit 1) && \
|
||||
echo "✅ Script create-team-page.sh terminé" && \
|
||||
echo "" && \
|
||||
echo "📋 Vérification de Navigation.tsx:" && \
|
||||
grep -q 'href="/team"' .techradar/src/components/Navigation/Navigation.tsx && echo "✅ Lien Équipe trouvé" || (echo "❌ Lien Équipe NON trouvé" && cat .techradar/src/components/Navigation/Navigation.tsx && exit 1) && \
|
||||
echo "📋 Vérification de team.tsx:" && \
|
||||
test -f .techradar/src/pages/team.tsx && echo "✅ team.tsx existe" || (echo "❌ team.tsx n'existe pas" && ls -la .techradar/src/pages/ 2>/dev/null && exit 1)
|
||||
# Créer la page Next.js /team
|
||||
RUN mkdir -p .techradar/src/pages && \
|
||||
cat > .techradar/src/pages/team.tsx << 'EOF' && \
|
||||
import Head from "next/head";
|
||||
import { CustomPage } from "@/pages/_app";
|
||||
|
||||
const TeamPage: CustomPage = () => {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Équipe & Technologies - Laplank</title>
|
||||
</Head>
|
||||
<div style={{ width: '100%', height: '100vh', border: 'none', margin: 0, padding: 0 }}>
|
||||
<iframe
|
||||
src="/team.html"
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
border: 'none',
|
||||
margin: 0,
|
||||
padding: 0
|
||||
}}
|
||||
title="Équipe & Technologies"
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default TeamPage;
|
||||
EOF
|
||||
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'(</Link>\s*</li>\s*)(\{/\*)'
|
||||
replacement = r'\1 <li className={styles.item}>\n <Link href="/team">\n <span className={styles.label}>👥 Équipe</span>\n </Link>\n </li>\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 </Link> de overview
|
||||
lines = content.split('\n')
|
||||
for i, line in enumerate(lines):
|
||||
if 'href="/overview"' in line:
|
||||
# Trouver la ligne </li> qui suit </Link>
|
||||
for j in range(i, min(i+10, len(lines))):
|
||||
if '</Link>' in lines[j] and j+1 < len(lines) and '</li>' in lines[j+1]:
|
||||
# Insérer après </li>
|
||||
new_lines = lines[:j+2] + [
|
||||
' <li className={styles.item}>',
|
||||
' <Link href="/team">',
|
||||
' <span className={styles.label}>👥 Équipe</span>',
|
||||
' </Link>',
|
||||
' </li>'
|
||||
] + 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
|
||||
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); \
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user