Lets the deployment check cope with pages the CMS host has filled

The check after a deploy compared the server's answer with dist byte for byte,
which fails once the host writes current data into the markers. Both sides are
now normalised first (regions, data block, offers, inline prices, site
address); everything else still has to match. The stand-in host no longer
injects the 404 page, like the real one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 17:02:17 +01:00
co-authored by Claude Sonnet 5.5
parent b2cb6351e1
commit d9ff875ade
5 changed files with 207 additions and 2 deletions
+15 -1
View File
@@ -115,13 +115,27 @@ check_exact_headers() {
fi
}
# Is het antwoord gelijk aan het bestand uit dist? De CMS-host mag de markers in
# de pagina's vullen (pakketten, banners, prijzen, JSON-LD-prijs, adres); die
# delen worden aan beide kanten weggehaald (config/normalizeInjected.ts), de
# rest moet nog steeds byte voor byte gelijk zijn.
same_page() {
local body="$1" expected="$2" here
cmp -s "$body" "$expected" && return 0
case "$expected" in *.html) ;; *) return 1 ;; esac
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
node "$here/../config/normalizeInjected.ts" "$body" "$work/norm-body.html" "https://andreaslop.nl" "${base%/}" || return 1
node "$here/../config/normalizeInjected.ts" "$expected" "$work/norm-dist.html" "https://andreaslop.nl" "${base%/}" || return 1
cmp -s "$work/norm-body.html" "$work/norm-dist.html"
}
# Een 200 met de bytes van het verwachte bestand uit dist
expect_file() {
local path="$1" file="$2"
fetch "$path"
if [ "$status" != "200" ]; then
fail "$path: status $status, verwacht 200"
elif ! cmp -s "$work/body" "$dist/$file"; then
elif ! same_page "$work/body" "$dist/$file"; then
fail "$path: antwoord is niet gelijk aan $file uit dist (oude serverconfig of oude build?)"
fi
check_security_headers "$path"