#!/usr/bin/env bash # frontend-bauen-box.sh — Frontend-Prüfungen und Build auf der KI-Box statt am PC (24.09.2026). # # Der PC hatte zu wenig freien Speicher (Spiel lief nebenher), tsc und eslint brachen mit „heap out of # memory" ab. Die Box hat genug davon und einen Node (den Hermes für seine Oberfläche mitbringt). # Geschickt wird der Arbeitsstand von frontend/ (ohne node_modules und dist), zurück kommt dist/. # # Nutzung (Git-Bash am PC, im Repo): bash deploy/frontend-bauen-box.sh # Ändert auf der Box nichts außer einem Wegwerf-Ordner unter /tmp. set -euo pipefail cd "$(dirname "$0")/.." BOX="${MC_BOX:-hitonabi@192.168.178.151}" ORDNER="/tmp/mc2-frontend-$$" echo "Frontend-Prüfung und Build auf $BOX …" tar --exclude=node_modules --exclude=dist -cf - frontend \ | ssh -o BatchMode=yes "$BOX" "rm -rf $ORDNER && mkdir -p $ORDNER && tar -x -C $ORDNER" # shellcheck disable=SC2029 # $ORDNER soll hier (am PC) eingesetzt werden ssh -o BatchMode=yes "$BOX" "set -e; export PATH=\$HOME/.hermes/node/bin:\$PATH; cd $ORDNER/frontend npm ci --no-audit --no-fund --loglevel=error echo '── Lint'; npm run --silent lint echo '── Typen'; npx tsc --noEmit echo '── Tests'; npm test --silent echo '── Build'; npm run --silent build" rm -rf frontend/dist ssh -o BatchMode=yes "$BOX" "tar -cf - -C $ORDNER/frontend dist && rm -rf $ORDNER" | tar -x -C frontend echo "✅ frontend/dist ist neu gebaut ($(du -sh frontend/dist | cut -f1))."