feat: Setup projet Classeo avec infrastructure Docker et architecture DDD

Configure l'environnement de développement complet avec Docker Compose,
structure DDD 4 Bounded Contexts, et pipeline CI/CD GitHub Actions.

Corrections compatibilité CI:
- Symfony 8 nécessite monolog-bundle ^4.0 (la v3.x ne supporte que jusqu'à Symfony 7)
- ESLint v9 nécessite flat config (eslint.config.js) - le format .eslintrc.cjs est obsolète
This commit is contained in:
2026-01-30 09:55:58 +01:00
parent ddefa927c7
commit 6da5996340
125 changed files with 10032 additions and 0 deletions

67
scripts/check-bc-isolation.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/bash
# =============================================================================
# Bounded Context Isolation Check
# Ensures Domain layer has no framework dependencies
# =============================================================================
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
ERRORS=0
echo "Checking Bounded Context isolation..."
echo ""
# Define forbidden imports in Domain layer
FORBIDDEN_PATTERNS=(
"use Symfony\\\\"
"use Doctrine\\\\"
"use ApiPlatform\\\\"
"use Lexik\\\\"
"#\[ORM\\\\"
"#\[ApiResource"
"#\[Assert\\\\"
)
# Check each BC Domain folder
for BC in Administration Scolarite VieScolaire Communication; do
DOMAIN_PATH="backend/src/${BC}/Domain"
if [ -d "$DOMAIN_PATH" ]; then
echo "Checking ${BC}/Domain..."
for pattern in "${FORBIDDEN_PATTERNS[@]}"; do
# Use grep with -r for recursive, -n for line numbers
if grep -rn "$pattern" "$DOMAIN_PATH" 2>/dev/null; then
echo -e "${RED}ERROR: Found forbidden import pattern '$pattern' in ${BC}/Domain${NC}"
ERRORS=$((ERRORS + 1))
fi
done
fi
done
# Check Shared/Domain as well
SHARED_DOMAIN="backend/src/Shared/Domain"
if [ -d "$SHARED_DOMAIN" ]; then
echo "Checking Shared/Domain..."
for pattern in "${FORBIDDEN_PATTERNS[@]}"; do
if grep -rn "$pattern" "$SHARED_DOMAIN" 2>/dev/null; then
echo -e "${RED}ERROR: Found forbidden import pattern '$pattern' in Shared/Domain${NC}"
ERRORS=$((ERRORS + 1))
fi
done
fi
echo ""
if [ $ERRORS -gt 0 ]; then
echo -e "${RED}BC Isolation check FAILED with $ERRORS error(s)${NC}"
echo "Domain layer must be pure PHP without framework dependencies."
exit 1
else
echo -e "${GREEN}BC Isolation check PASSED${NC}"
exit 0
fi

114
scripts/check-naming.sh Executable file
View File

@@ -0,0 +1,114 @@
#!/bin/bash
# =============================================================================
# Naming Conventions Check
# Ensures code follows Classeo naming conventions
# =============================================================================
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
WARNINGS=0
ERRORS=0
echo "Checking naming conventions..."
echo ""
# =============================================================================
# PHP Backend Checks
# =============================================================================
echo "=== PHP Backend Checks ==="
# Check all PHP files have declare(strict_types=1) on line 1 or 3 (after opening tag)
echo "Checking strict_types declarations..."
for file in $(find backend/src -name "*.php" 2>/dev/null); do
if ! grep -q "declare(strict_types=1)" "$file"; then
echo -e "${RED}ERROR: Missing declare(strict_types=1) in $file${NC}"
ERRORS=$((ERRORS + 1))
fi
done
# Check that Value Objects are readonly
echo "Checking Value Objects are readonly..."
for file in $(find backend/src -path "*/Domain/Model/*Id.php" 2>/dev/null); do
if ! grep -q "readonly class" "$file"; then
echo -e "${YELLOW}WARNING: Value Object should be readonly: $file${NC}"
WARNINGS=$((WARNINGS + 1))
fi
done
# Check Domain Events naming (should end with past tense verbs)
echo "Checking Domain Event naming..."
for file in $(find backend/src -path "*/Domain/Event/*.php" 2>/dev/null); do
filename=$(basename "$file" .php)
# Events should end with past tense (ed, en, etc.)
if [[ ! "$filename" =~ (ed|en|t|Created|Updated|Deleted|Recorded|Registered|Assigned|Completed)$ ]]; then
echo -e "${YELLOW}WARNING: Domain Event should use past tense: $filename${NC}"
WARNINGS=$((WARNINGS + 1))
fi
done
# =============================================================================
# Frontend Checks
# =============================================================================
echo ""
echo "=== Frontend Checks ==="
# Check Svelte components are PascalCase
echo "Checking Svelte component naming..."
for file in $(find frontend/src -name "*.svelte" 2>/dev/null); do
filename=$(basename "$file" .svelte)
# Skip +page.svelte, +layout.svelte, +error.svelte
if [[ "$filename" != +* ]]; then
# Check first character is uppercase
if [[ ! "$filename" =~ ^[A-Z] ]]; then
echo -e "${YELLOW}WARNING: Svelte component should be PascalCase: $file${NC}"
WARNINGS=$((WARNINGS + 1))
fi
fi
done
# Check for Svelte 4 patterns (forbidden)
echo "Checking for Svelte 4 patterns (should use Svelte 5 runes)..."
for file in $(find frontend/src -name "*.svelte" -o -name "*.ts" 2>/dev/null); do
# Check for writable/readable stores (Svelte 4)
if grep -q "from 'svelte/store'" "$file" 2>/dev/null; then
echo -e "${RED}ERROR: Using svelte/store (Svelte 4) instead of runes: $file${NC}"
ERRORS=$((ERRORS + 1))
fi
# Check for on:click (Svelte 4) instead of onclick (Svelte 5)
if grep -q "on:click" "$file" 2>/dev/null; then
echo -e "${RED}ERROR: Using on:click (Svelte 4) instead of onclick (Svelte 5): $file${NC}"
ERRORS=$((ERRORS + 1))
fi
# Check for export let (Svelte 4) instead of $props (Svelte 5)
if grep -q "export let" "$file" 2>/dev/null; then
echo -e "${RED}ERROR: Using 'export let' (Svelte 4) instead of \$props (Svelte 5): $file${NC}"
ERRORS=$((ERRORS + 1))
fi
done
# =============================================================================
# Summary
# =============================================================================
echo ""
echo "=== Summary ==="
if [ $ERRORS -gt 0 ]; then
echo -e "${RED}Naming check FAILED with $ERRORS error(s) and $WARNINGS warning(s)${NC}"
exit 1
elif [ $WARNINGS -gt 0 ]; then
echo -e "${YELLOW}Naming check PASSED with $WARNINGS warning(s)${NC}"
exit 0
else
echo -e "${GREEN}Naming check PASSED${NC}"
exit 0
fi