veza/tmt/tests/frontend/no_critical_js.sh

32 lines
836 B
Bash
Raw Normal View History

#!/bin/bash
set -e
REPO_ROOT=$(git rev-parse --show-toplevel)
WEB_DIR="$REPO_ROOT/apps/web"
INDEX_HTML="$WEB_DIR/index.html"
echo "📍 Frontend No-Critical-JS Check"
if [ ! -f "$INDEX_HTML" ]; then
echo "❌ index.html not found!"
exit 1
fi
echo "🔎 Checking for <noscript> tag in index.html..."
if grep -q "<noscript>" "$INDEX_HTML"; then
echo "✅ <noscript> tag found."
else
echo "❌ <noscript> tag MISSING. The app is invisible without JS."
echo " Please add a <noscript> tag with a basic message."
exit 1
fi
# Optional: Check if root is not empty (SSR/Prerendering check)
# This is stricter, maybe for later.
# if grep -Pqz '<div id="root">.+</div>' "$INDEX_HTML"; then
# echo "✅ Root div has initial content."
# else
# echo "⚠️ Root div is empty (Client-side rendering only)."
# fi