Initial commit (unpacked platform)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# Varumärkesvakt (beslut D-026): varumärkesnamn får ENDAST finnas i brand.config.json.
|
||||
# Körs i CI och kan köras lokalt: ./scripts/brand-guard.sh
|
||||
#
|
||||
# Vaktar två saker:
|
||||
# 1. Det gamla arbetsnamnet får aldrig återinträda någonstans.
|
||||
# 2. Det AKTUELLA namnet i brand.config.json får inte hårdkodas i kod
|
||||
# (README/docs får nämna det; kod, seed och infrastruktur får det inte).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
FAIL=0
|
||||
|
||||
# 1. Historiska/förbjudna namn – uppdatera listan vid namnbyte.
|
||||
FORBIDDEN=("matrivo")
|
||||
for name in "${FORBIDDEN[@]}"; do
|
||||
HITS=$(grep -ril "$name" . \
|
||||
--exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist \
|
||||
--exclude-dir=.turbo --exclude-dir=.expo --exclude-dir=.data \
|
||||
--exclude=brand-guard.sh 2>/dev/null || true)
|
||||
if [ -n "$HITS" ]; then
|
||||
echo "FEL: förbjudet namn '$name' hittades i:"
|
||||
echo "$HITS"
|
||||
FAIL=1
|
||||
fi
|
||||
done
|
||||
|
||||
# 2. Aktuellt namn utanför brand.config.json i kod/infrastruktur.
|
||||
CURRENT=$(node -e "console.log(require('./brand.config.json').name)")
|
||||
HITS=$(grep -rl "$CURRENT" apps packages infrastructure \
|
||||
--include="*.ts" --include="*.tsx" --include="*.sql" --include="*.yml" \
|
||||
--include="*.yaml" --include="Dockerfile*" \
|
||||
--exclude-dir=node_modules --exclude-dir=dist --exclude-dir=.turbo 2>/dev/null || true)
|
||||
if [ -n "$HITS" ]; then
|
||||
echo "FEL: aktuella namnet '$CURRENT' är hårdkodat utanför brand.config.json i:"
|
||||
echo "$HITS"
|
||||
echo "Använd BRAND.name / {brand}-interpolation i stället."
|
||||
FAIL=1
|
||||
fi
|
||||
|
||||
if [ "$FAIL" -eq 0 ]; then
|
||||
echo "Varumärkesvakt: OK – namnet lever endast i brand.config.json."
|
||||
fi
|
||||
exit $FAIL
|
||||
Reference in New Issue
Block a user