Repository Public
1#!/usr/bin/env bash2# Proves that what is committed is enough to build: a file hidden by .gitignore (it happened: an unanchored3# `data/` rule hid src/components/data/) or simply never added makes a clean checkout fail while the working4# tree looks fine.5# 1. no file under a source directory may be git-ignored;6# 2. no untracked file may sit under a source directory;7# 3. a `git archive HEAD` export must type-check on its own (it only borrows node_modules).8set -euo pipefail9cd "$(dirname "$0")/.."10SOURCES='^(src|scripts|tests|e2e|content|brand|public|docs)/'11ALLOWED='^(e2e/\.tmp/|docs/screenshots/(production|apercu)/)'12IGNORED="$(git ls-files --others -i --exclude-standard | grep -E "$SOURCES" | grep -v -E "$ALLOWED" || true)"13if [ -n "$IGNORED" ]; then echo "$IGNORED"; echo "✗ fichier(s) source ignoré(s) par .gitignore"; exit 1; fi14UNTRACKED="$(git ls-files --others --exclude-standard | grep -E "$SOURCES|^[^/]+\.(ts|mjs|cjs|json|yaml)$" || true)"15if [ -n "$UNTRACKED" ]; then echo "$UNTRACKED"; echo "✗ fichier(s) source non suivi(s) par git : les ajouter (ou les ignorer explicitement) avant de livrer"; exit 1; fi16TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT17git archive HEAD | tar -x -C "$TMP"18ln -s "$PWD/node_modules" "$TMP/node_modules"19[ -f next-env.d.ts ] && cp next-env.d.ts "$TMP/next-env.d.ts" # generated by Next at build time; only declares asset module types20(cd "$TMP" && node_modules/.bin/tsc --noEmit -p tsconfig.json)21echo "✓ l'export propre de $(git rev-parse --short HEAD) ($(git ls-files | wc -l | tr -d ' ') fichiers) se vérifie seul ; aucun fichier source ignoré ou non suivi"22