47 lines
1.4 KiB
Bash
Executable File
47 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
set -euo pipefail
|
|
|
|
# Synchronise .gitignore, .cursorignore, .dockerignore du root 4NK_env
|
|
# vers tous les 4NK_modules/ (sauf 4NK_vault) et les sous-projets sous projects/
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
|
|
|
|
SRC_GITIGNORE="$ROOT_DIR/.gitignore"
|
|
SRC_CURSORIGNORE="$ROOT_DIR/.cursorignore"
|
|
SRC_DOCKERIGNORE="$ROOT_DIR/.dockerignore"
|
|
|
|
copy_files() {
|
|
TARGET_DIR="$1"
|
|
[ -d "$TARGET_DIR" ] || return 0
|
|
echo "[sync] $TARGET_DIR"
|
|
[ -f "$SRC_GITIGNORE" ] && cp -f "$SRC_GITIGNORE" "$TARGET_DIR/.gitignore" || true
|
|
[ -f "$SRC_CURSORIGNORE" ] && cp -f "$SRC_CURSORIGNORE" "$TARGET_DIR/.cursorignore" || true
|
|
[ -f "$SRC_DOCKERIGNORE" ] && cp -f "$SRC_DOCKERIGNORE" "$TARGET_DIR/.dockerignore" || true
|
|
}
|
|
|
|
echo "[info] Root: $ROOT_DIR"
|
|
echo "[info] Sources: $SRC_GITIGNORE, $SRC_CURSORIGNORE, $SRC_DOCKERIGNORE"
|
|
|
|
# 1) 4NK_modules/* sauf 4NK_vault
|
|
for d in "$ROOT_DIR"/4NK_modules/*; do
|
|
[ -d "$d" ] || continue
|
|
base="$(basename "$d")"
|
|
if [ "$base" = "4NK_vault" ]; then
|
|
echo "[skip] $d (excluded)"
|
|
continue
|
|
fi
|
|
copy_files "$d"
|
|
done
|
|
|
|
# 2) Sous-projets sous projects/*/* (ex: projects/lecoffre/lecoffre_node, lecoffre-front, ...)
|
|
for p in "$ROOT_DIR"/projects/*; do
|
|
[ -d "$p" ] || continue
|
|
for sub in "$p"/*; do
|
|
[ -d "$sub" ] || continue
|
|
copy_files "$sub"
|
|
done
|
|
done
|
|
|
|
echo "[done] Ignore files synchronised."
|