diff --git a/build/tasks/verify/verify-html-valid-for-vnu.mts b/build/tasks/verify/verify-html-valid-for-vnu.mts index 7d2b49d70..ae248b50b 100644 --- a/build/tasks/verify/verify-html-valid-for-vnu.mts +++ b/build/tasks/verify/verify-html-valid-for-vnu.mts @@ -10,6 +10,14 @@ import vnu from 'vnu-jar'; const htmlFiles = await glob(['_site/**.html', '!node_modules/']); +// vnu responds to being given no files by printing its entire usage page and +// exiting non-zero, which buries the actual problem: this task checks the +// built site, and there is nothing built to check. +if (htmlFiles.length === 0) { + console.error('No HTML under _site/ to check. Run `nps build` first.'); + process.exit(1); +} + let exitCode = 0; const scripts = [`java -jar ${vnu} ${htmlFiles.join(' ')}`]; diff --git a/package-scripts.yml b/package-scripts.yml index ead81be52..2f37c1de6 100644 --- a/package-scripts.yml +++ b/package-scripts.yml @@ -6,7 +6,10 @@ scripts: buildStyles: tsx build/tasks/compile/build-styles.mts siteifyHealthFiles: tsx build/tasks/compile/siteify-health-files.mts verify: - all: 'rc=0; for i in build/tasks/verify/*.mts; do tsx "$i" || rc=1; done; exit $rc' + # Announces each task and names the ones that failed. Without this the + # output is a wall of tool chatter with no indication of which of the + # thirteen produced it. + all: 'rc=0; failed=; for i in build/tasks/verify/*.mts; do echo "==> $i"; tsx "$i" || { rc=1; failed="$failed $i"; }; done; [ -z "$failed" ] || echo "FAILED:$failed" >&2; exit $rc' browserslist: tsx build/tasks/verify/verify-browserslist.mts scss: tsx build/tasks/verify/verify-scss.mts dockerfile: tsx build/tasks/verify/verify-dockerfile.mts