#!/usr/bin/env bash
# scripts/check-build.sh: build, then fail on what Stati only reports
set -o pipefail
npm run build 2>&1 | tee build.log || exit 1
if grep -E "Falling back to default configuration|Error rendering layout|No layout template found|Failed to render partial" build.log; then
echo "Stati fell back to a default, see above" >&2
exit 1
fi
if grep -rl --include='*.html' "<!-- Error rendering partial" dist; then
echo "A partial failed to render in the pages above" >&2
exit 1
fi
A production build does what it can and keeps going:
- a config that doesn't load is replaced by the defaults, so the site gets the default title and
http://localhost:3000in its canonical links; - a layout that throws gives its page a bare fallback document;
- a partial that throws becomes
<!-- Error rendering partial: name -->in the page.
Each of them is logged, and the exit code is still 0. The dev server is stricter and stops a failing template with its error overlay.
Run the check on a build that renders every page, which is what a CI job from a clean checkout does. Pages served from the cache aren't rendered, so they log nothing; the dist check still finds their partial errors.
In the Stati docs: Partial build success, Template fallback and Site uses the default title or localhost URLs.