Repository navigation
prerender-audit 1.0.0
Checks that a static site's sitemap.xml and its prerendered HTML describe the
same set of pages, before an artifact is promoted.
Zero dependencies. Node's standard library only. Requires Node 18 or newer.
What it checks
- advertised but NOT prerendered - the sitemap promises a URL and the build
has no file behind it. This is the case that 404s. - prerendered but not advertised - a built page nobody can reach.
- offsite or malformed URL - a sitemap entry pointing at another host.
- duplicate sitemap entries.
404.html is ignored by default; override with --extra.
Exit codes: 0 agreement, 1 mismatch or unusable input, 2 bad invocation.
Install
This release is distributed from GitHub. The package is not published to npm,
so npm install prerender-audit will not work.
# no install at all
git clone https://github.com/RupamDotInfo/prerender-audit.git
node prerender-audit/prerender-audit.mjs dist --origin https://example.com
# or as a dependency
npm install --save-dev github:RupamDotInfo/prerender-audit
npx prerender-audit dist --origin https://example.com
# or from this tag
npm install --save-dev https://github.com/RupamDotInfo/prerender-audit/archive/refs/tags/v1.0.0.tar.gzVerified for this release
- 30 unit tests pass (
node --test, no install required) - 15 package checks pass (
node scripts/package-smoke.mjs), which packs the
tarball, installs it into a throwaway project, and runs the installed command - GitHub Actions run 39255040287: three jobs, all green on the tagged commit
- The documented install commands above were each executed from a clean
checkout against a real fixture
Notes
Two behaviours worth knowing:
Empty input is never treated as agreement. A sitemap containing no URLs, or
a directory containing no HTML, exits non-zero with INPUT UNUSABLE. This was a
real bug in earlier development: run against a site whose origin was down, the
fetch returned an HTTP error page, the parser found nothing, and the tool
reported OK because zero URLs trivially matched zero files.
The command works through the npm bin symlink. An earlier version compared
the module name against process.argv[1], which does not match on Linux and
macOS where npm installs a symlink. The CLI silently did nothing and exited 0 -
so a CI step running npx prerender-audit would have passed against a broken
build. Found by the package smoke test; fixed and covered by a regression test.
Limitations
It reads files, not URLs: it cannot tell you a page exists but returns 500, has
broken internal links, or that an asset 404s. Flat output directories only. Query
strings are ignored when mapping a URL to a file. A sitemapindex is treated as
a sitemap; nested sitemaps are not fetched. HTML is not validated. Redirects are
not modelled. See the README for the full list.
Licence
MIT.