From b583a68e8299e43cba955c8badb8cfe3c90e8e48 Mon Sep 17 00:00:00 2001 From: bendazzarius-maker Date: Mon, 18 Aug 2025 16:55:50 +0200 Subject: [PATCH] docs: document reset-and-start workflow --- IdeWebGlGameEngine/Start_Server.sh | 77 ++---------------------------- README.md | 17 ++++++- 2 files changed, 21 insertions(+), 73 deletions(-) mode change 100644 => 100755 IdeWebGlGameEngine/Start_Server.sh diff --git a/IdeWebGlGameEngine/Start_Server.sh b/IdeWebGlGameEngine/Start_Server.sh old mode 100644 new mode 100755 index 7c66235..e7e32f9 --- a/IdeWebGlGameEngine/Start_Server.sh +++ b/IdeWebGlGameEngine/Start_Server.sh @@ -1,76 +1,9 @@ #!/usr/bin/env bash -# start_server.sh — Serveur local Python "double-clic friendly" avec aide en cas de port occupé. - -PORT="${PORT:-5173}" -START_PATH="${START_PATH:-index.html}" +# start_server.sh — helper to reinstall dependencies and run Vite. +# Matches the manual workflow: remove existing modules, reinstall, start dev server. cd "$(dirname "$0")" || exit 1 -PY=python3; command -v python3 >/dev/null 2>&1 || PY=python -if ! command -v "$PY" >/dev/null 2>&1; then - echo "Python introuvable. Installe python3 : sudo apt install python3" - read -rp "Entrée pour fermer..."; exit 1 -fi - -busy_info() { - ss -ltnp "( sport = :$PORT )" 2>/dev/null | sed 's/^/ /' -} - -# --- Port occupé ? Proposer d'agir --- -if ss -ltnp "( sport = :$PORT )" 2>/dev/null | grep -q LISTEN; then - echo "⚠️ Le port $PORT est déjà occupé :" - busy_info - echo - read -rp "Voulez-vous libérer ce port ? [o=oui / p=changer de port / n=annuler] " ans - case "$ans" in - o|O|y|Y) - if command -v fuser >/dev/null 2>&1; then - fuser -k "${PORT}"/tcp || true - sleep 0.5 - else - # Kill doux via ss/grep/awk si fuser absent - PIDS=$(ss -ltnp "( sport = :$PORT )" | sed -n 's/.*pid=\([0-9]\+\).*/\1/p' | sort -u) - for p in $PIDS; do kill -TERM "$p" 2>/dev/null || true; done - sleep 0.5 - fi - if ss -ltnp "( sport = :$PORT )" | grep -q LISTEN; then - echo "Le port $PORT est encore occupé :"; busy_info - read -rp "Forcer l'arrêt ? (k=kill -9 / p=changer de port / autre=annuler) " ans2 - case "$ans2" in - k|K) - if command -v fuser >/dev/null 2>&1; then fuser -k -9 "${PORT}"/tcp || true - else - PIDS=$(ss -ltnp "( sport = :$PORT )" | sed -n 's/.*pid=\([0-9]\+\).*/\1/p' | sort -u) - for p in $PIDS; do kill -9 "$p" 2>/dev/null || true; done - fi - sleep 0.3 - ;; - p|P) - read -rp "Nouveau port : " PORT ;; - *) echo "Annulé."; read -rp "Entrée pour fermer..."; exit 2 ;; - esac - fi - ;; - p|P) - read -rp "Nouveau port : " PORT ;; - *) - echo "Annulé."; read -rp "Entrée pour fermer..."; exit 2 ;; - esac -fi - -URL="http://127.0.0.1:$PORT/" -[ -f "$START_PATH" ] && URL="http://127.0.0.1:$PORT/$START_PATH" - -echo "Démarrage : $URL" -"$PY" -m http.server "$PORT" --bind 127.0.0.1 --directory "." & -PID=$! - -sleep 0.4 -command -v xdg-open >/dev/null 2>&1 && xdg-open "$URL" >/dev/null 2>&1 & - -echo "Serveur PID $PID — stop: Ctrl+C" -wait "$PID" -CODE=$? -echo "Serveur arrêté (code $CODE)." -read -rp "Entrée pour fermer..." -exit "$CODE" +rm -rf node_modules package-lock.json +npm install +npm run dev diff --git a/README.md b/README.md index ad04f6f..871ccdd 100644 --- a/README.md +++ b/README.md @@ -1 +1,16 @@ -# IdeGameWebEngine \ No newline at end of file +# IdeGameWebEngine + +## Development + +This project uses npm and Vite. To run the development server with Vue support: + +```bash +cd IdeWebGlGameEngine +rm -rf node_modules package-lock.json +npm install +npm run dev # or: ./Start_Server.sh +``` + +The script duplicates the manual commands above: it clears existing dependencies, +reinstalls them, then launches the Vite dev server with Vue support. +