From 73b2cf300d655c753013cd5523ccf2c35e0f83ac Mon Sep 17 00:00:00 2001 From: Matthieu Date: Wed, 1 Apr 2026 14:19:20 +0200 Subject: [PATCH] refactor : rename Inventory_frontend to frontend everywhere Update Dockerfile, nginx, .dockerignore, makefile, CI workflow, CLAUDE.md, README, release script to use frontend/ instead of Inventory_frontend/. Remove submodule references from CI and release script. Co-Authored-By: Claude Opus 4.6 (1M context) --- .dockerignore | 8 ++-- .gitea/workflows/build-docker.yml | 2 - CLAUDE.md | 6 +-- README.md | 8 ++-- deploy/docker/Dockerfile.prod | 8 ++-- deploy/docker/nginx.conf | 2 +- makefile | 10 ++--- scripts/release.sh | 68 +++++-------------------------- 8 files changed, 31 insertions(+), 81 deletions(-) diff --git a/.dockerignore b/.dockerignore index b6ecff4..db2ba9d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,9 +6,9 @@ docker/ deploy/docker/docker-compose.prod.yml deploy/docker/deploy.sh deploy/docker/.env.example -Inventory_frontend/node_modules -Inventory_frontend/.nuxt -Inventory_frontend/.output +frontend/node_modules +frontend/.nuxt +frontend/.output var/ vendor/ LOG/ @@ -21,4 +21,4 @@ scripts/ *.md !composer.lock !symfony.lock -!Inventory_frontend/package-lock.json +!frontend/package-lock.json diff --git a/.gitea/workflows/build-docker.yml b/.gitea/workflows/build-docker.yml index cfcbb97..dd3f71f 100644 --- a/.gitea/workflows/build-docker.yml +++ b/.gitea/workflows/build-docker.yml @@ -11,8 +11,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - submodules: true - name: Login to Gitea Registry run: | diff --git a/CLAUDE.md b/CLAUDE.md index 84034bb..003b324 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,7 +43,7 @@ Inventory/ # Backend Symfony (repo principal) ├── pre-commit, commit-msg # Git hooks ├── makefile # Commandes Docker/dev ├── VERSION # Source unique de version (semver) -├── Inventory_frontend/ # ← SUBMODULE GIT (repo séparé) +├── frontend/ # ← SUBMODULE GIT (repo séparé) │ ├── app/pages/ # Pages Nuxt (file-based routing) │ ├── app/components/ # Composants Vue (auto-imported) │ ├── app/composables/ # Composables Vue @@ -67,7 +67,7 @@ make test FILES=tests/Api/Entity/MachineTest.php # Un test spécifique make php-cs-fixer-allow-risky # Linter PHP (cs-fixer) docker exec -u www-data php-inventory-apache php bin/console doctrine:migrations:migrate -# Frontend (dans Inventory_frontend/) +# Frontend (dans frontend/) npm run dev # Dev server (port 3001) npm run build # Build production npm run lint:fix # ESLint fix @@ -109,7 +109,7 @@ Exemples : ### Submodule Workflow Le frontend est un submodule git. Lors d'un commit frontend : -1. Commit dans `Inventory_frontend/` d'abord +1. Commit dans `frontend/` d'abord 2. Commit dans le repo principal pour mettre à jour le pointeur submodule 3. Push les deux repos diff --git a/README.md b/README.md index 0e31ae7..0f36c6c 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ Inventory/ # Backend Symfony (repo principal) ├── docker/ # Dockerfile + config Docker ├── makefile # Commandes de dev raccourcies ├── VERSION # Version courante (ex: 1.8.1) -└── Inventory_frontend/ # Submodule git (frontend, repo séparé) +└── frontend/ # Submodule git (frontend, repo séparé) ├── app/pages/ # Les pages de l'app (1 fichier = 1 route URL) ├── app/components/ # Composants Vue réutilisables ├── app/composables/ # Logique métier partagée (appels API, états) @@ -289,9 +289,9 @@ Le hook `pre-commit` s'exécute automatiquement avant chaque commit : ### Submodule frontend -Le frontend est un **submodule git** dans `Inventory_frontend/` (c'est un repo git séparé, inclus dans le repo principal). Workflow de commit : +Le frontend est un **submodule git** dans `frontend/` (c'est un repo git séparé, inclus dans le repo principal). Workflow de commit : -1. Commiter dans `Inventory_frontend/` d'abord +1. Commiter dans `frontend/` d'abord 2. Commiter dans le repo principal pour mettre à jour le pointeur du submodule 3. Pousser les deux repos @@ -302,4 +302,4 @@ Le frontend est un **submodule git** dans `Inventory_frontend/` (c'est un repo g - **[DEPLOY.md](DEPLOY.md)** : guide de déploiement serveur (Nginx, PHP-FPM, PostgreSQL) - **[RELEASE.md](RELEASE.md)** : processus de release et versioning - **[CHANGELOG.md](CHANGELOG.md)** : historique des versions -- **[Frontend README](Inventory_frontend/README.md)** : documentation du frontend Nuxt +- **[Frontend README](frontend/README.md)** : documentation du frontend Nuxt diff --git a/deploy/docker/Dockerfile.prod b/deploy/docker/Dockerfile.prod index f27b86c..abfca4b 100644 --- a/deploy/docker/Dockerfile.prod +++ b/deploy/docker/Dockerfile.prod @@ -26,11 +26,11 @@ RUN composer dump-autoload --optimize --no-dev # --- Stage 2: Build frontend --- FROM node:lts-alpine AS frontend-build -WORKDIR /app/Inventory_frontend -COPY Inventory_frontend/package.json Inventory_frontend/package-lock.json ./ +WORKDIR /app/frontend +COPY frontend/package.json frontend/package-lock.json ./ RUN npm ci -COPY Inventory_frontend/ ./ +COPY frontend/ ./ ENV CI=1 \ NUXT_TELEMETRY_DISABLED=1 \ NUXT_PUBLIC_API_BASE_URL=/api \ @@ -68,7 +68,7 @@ COPY deploy/docker/nginx.conf /etc/nginx/sites-enabled/inventory.conf COPY --from=backend-build /app /var/www/html # Frontend from stage 2 -COPY --from=frontend-build /app/Inventory_frontend/.output/public /var/www/html/Inventory_frontend/.output/public +COPY --from=frontend-build /app/frontend/.output/public /var/www/html/frontend/.output/public # Symfony needs a .env file to boot (variables are overridden by env_file in docker-compose) RUN echo "APP_ENV=prod" > /var/www/html/.env diff --git a/deploy/docker/nginx.conf b/deploy/docker/nginx.conf index b3484af..89c87fa 100644 --- a/deploy/docker/nginx.conf +++ b/deploy/docker/nginx.conf @@ -2,7 +2,7 @@ server { listen 80; server_name _; - root /var/www/html/Inventory_frontend/.output/public; + root /var/www/html/frontend/.output/public; index index.html; access_log /dev/stdout; diff --git a/makefile b/makefile index 9299ade..7b1ff4e 100644 --- a/makefile +++ b/makefile @@ -36,7 +36,7 @@ start: env-init @echo "" @echo "URLs disponibles:" @echo "- Symfony API: http://localhost:8081/api" - @echo "- Nuxt (Inventory_frontend): http://localhost:3001" + @echo "- Nuxt (frontend): http://localhost:3001" @echo "- adminer: http://localhost:5050" # Éteint le container @@ -56,16 +56,16 @@ composer-install: $(EXEC_PHP) composer install build-nuxtJS: -# $(EXEC_PHP) cp -n Inventory_frontend/.env.dist Inventory_frontend/.env.local - $(EXEC_PHP) sh -lc "cd Inventory_frontend && npm install && npm run generate" +# $(EXEC_PHP) cp -n frontend/.env.dist frontend/.env.local + $(EXEC_PHP) sh -lc "cd frontend && npm install && npm run generate" dev-nuxt: - $(EXEC_PHP) sh -lc "cd Inventory_frontend && npm run dev" + $(EXEC_PHP) sh -lc "cd frontend && npm run dev" delete_built_dir: CURRENT_UID=$(shell id -u) CURRENT_GID=$(shell id -g) $(DOCKER_COMPOSE) up -d $(DOCKER) exec -u root $(PHP_CONTAINER) rm -rf vendor/ - $(DOCKER) exec -u root $(PHP_CONTAINER) rm -rf Inventory_frontend/node_modules + $(DOCKER) exec -u root $(PHP_CONTAINER) rm -rf frontend/node_modules remove_orphans: $(DOCKER_COMPOSE) kill diff --git a/scripts/release.sh b/scripts/release.sh index 5188fa5..c9a0992 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -13,7 +13,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" VERSION_FILE="$PROJECT_ROOT/VERSION" API_PLATFORM_FILE="$PROJECT_ROOT/config/packages/api_platform.yaml" -FRONTEND_DIR="$PROJECT_ROOT/Inventory_frontend" # Lire la version actuelle current_version=$(cat "$VERSION_FILE" | tr -d '\n') @@ -112,68 +111,28 @@ fi cd "$PROJECT_ROOT" # =========================================== -# ÉTAPE 1 : Gérer le submodule frontend +# ÉTAPE 1 : Mettre à jour VERSION # =========================================== -echo "" -echo -e "${BLUE}[1/6]${NC} Vérification du submodule frontend..." - -cd "$FRONTEND_DIR" - -# Vérifier s'il y a des changements non commités dans le submodule -if ! git diff --quiet --exit-code || ! git diff --cached --quiet --exit-code; then - echo -e "${YELLOW}Changements détectés dans le submodule frontend${NC}" - git status --short - echo "" - read -p "Commiter ces changements dans le submodule ? (y/N) " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - git add -A - git commit -m "chore(release) : prepare v$new_version" - else - echo -e "${RED}Erreur:${NC} Veuillez d'abord commiter les changements du submodule." - exit 1 - fi -fi - -# =========================================== -# ÉTAPE 2 : Tag le submodule -# =========================================== -echo -e "${BLUE}[2/6]${NC} Création du tag v$new_version dans le submodule..." - -# Vérifier si le tag existe déjà -if git rev-parse "v$new_version" >/dev/null 2>&1; then - echo -e "${YELLOW}Le tag v$new_version existe déjà dans le submodule${NC}" -else - git tag -a "v$new_version" -m "Release v$new_version" - echo -e "${GREEN}Tag v$new_version créé dans le submodule${NC}" -fi - -# Retourner au projet principal -cd "$PROJECT_ROOT" - -# =========================================== -# ÉTAPE 3 : Mettre à jour VERSION -# =========================================== -echo -e "${BLUE}[3/6]${NC} Mise à jour du fichier VERSION..." +echo -e "${BLUE}[1/4]${NC} Mise à jour du fichier VERSION..." echo "$new_version" > "$VERSION_FILE" # =========================================== -# ÉTAPE 4 : Mettre à jour api_platform.yaml +# ÉTAPE 2 : Mettre à jour api_platform.yaml # =========================================== -echo -e "${BLUE}[4/6]${NC} Mise à jour de api_platform.yaml..." +echo -e "${BLUE}[2/4]${NC} Mise à jour de api_platform.yaml..." sed -i "s/version: .*/version: $new_version/" "$API_PLATFORM_FILE" # =========================================== -# ÉTAPE 5 : Commit principal (avec mise à jour du submodule) +# ÉTAPE 3 : Commit # =========================================== -echo -e "${BLUE}[5/6]${NC} Création du commit principal..." -git add "$VERSION_FILE" "$API_PLATFORM_FILE" "$FRONTEND_DIR" +echo -e "${BLUE}[3/4]${NC} Création du commit..." +git add "$VERSION_FILE" "$API_PLATFORM_FILE" git commit -m "chore(release) : v$new_version" # =========================================== -# ÉTAPE 6 : Tag principal +# ÉTAPE 4 : Tag # =========================================== -echo -e "${BLUE}[6/6]${NC} Création du tag v$new_version..." +echo -e "${BLUE}[4/4]${NC} Création du tag v$new_version..." git tag -a "v$new_version" -m "Release v$new_version" echo "" @@ -182,14 +141,7 @@ echo "" echo "================================" echo -e "${YELLOW}Prochaines étapes :${NC}" echo "" -echo "1. Pousser le submodule frontend :" -echo -e " ${BLUE}cd Inventory_frontend && git push && git push --tags && cd ..${NC}" -echo "" -echo "2. Pousser le projet principal :" +echo "Pousser le projet :" echo -e " ${BLUE}git push && git push --tags${NC}" echo "" -echo "3. Créer les releases sur Gitea :" -echo " - Inventory_frontend : tag v$new_version" -echo " - Inventory (backend) : tag v$new_version" -echo "" echo "================================"