← back to Dw Photo Capture
selfcheck.sh
22 lines
#!/bin/sh
# Quick health: static lint (fast, no run) -> server-side checks -> deep UI click-through.
cd "$(dirname "$0")" || exit 1
# Static layer: catch undefined-var / typo / unreachable bugs WITHOUT running the app
# (this is the gate that would have caught the getLS crash before it shipped).
echo "--- static lint (eslint) ---"
if [ -d node_modules/.bin ]; then
npm run --silent lint && echo "lint: clean" || echo "lint: issues above ^"
else
echo "lint: skipped (run 'npm install' once to enable)"
fi
echo "\n--- unit tests (pure OCR/vendor fns) ---"
node "$(dirname "$0")/test-analyze-ocr.js" || echo "unit tests: FAILED above ^"
echo "\n--- /selfcheck (server-side) ---"
curl -s -u admin:DW2024! http://127.0.0.1:9890/selfcheck | python3 -m json.tool 2>/dev/null
# Deep: headless click-through for dead links (needs global playwright)
echo "\n--- deep UI click-through (dead links) ---"
GP=$(npm root -g 2>/dev/null); NODE_PATH="$GP" node "$(dirname "$0")/selfcheck-ui.cjs" 2>&1 | sed -n '/FAILED REQUESTS/,$p'