also looking at this
Adopt the hq-apps app conventions
#76
31 files
+1656
-395
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -299,6 +299,38 @@ for (const p of pages) html.set(p, await Bun.file(p).text()) | ||
| 299 | 299 | ) |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | // 6h. Every getStaticPaths-wired route actually produced pages. | |
| 303 | // | |
| 304 | // This closes a hole the other checks cannot see. When the database has no | |
| 305 | // content, every hook returns zero paths, so no dynamic page is built — AND | |
| 306 | // the sitemap, which is built from the same queries, shrinks to match. The | |
| 307 | // two then agree with each other, "every sitemap URL has a built file" | |
| 308 | // stays true, and the gate passes over an artifact that dropped from 151 | |
| 309 | // pages to 41. Agreement between two outputs of the same broken query is | |
| 310 | // not evidence that either is right. | |
| 311 | // | |
| 312 | // Caught exactly that: a wiped dev database produced a green 15/15 build | |
| 313 | // containing no judges, no courthouses and no articles. | |
| 314 | { | |
| 315 | const routes: Array<[string, string]> = [ | |
| 316 | ['judges/*/profile.html', 'judges'], | |
| 317 | ['court-houses/*/profile.html', 'court-houses'], | |
| 318 | ['article/*.html', 'article'], | |
| 319 | ] | |
| 320 | const empty: string[] = [] | |
| 321 | for (const [pattern, label] of routes) { | |
| 322 | let n = 0 | |
| 323 | for (const _f of new Bun.Glob(pattern).scanSync('dist')) n++ | |
| 324 | if (n === 0) | |
| 325 | empty.push(label) | |
| 326 | } | |
| 327 | add( | |
| 328 | 'dynamic routes produced pages', | |
| 329 | empty.length === 0, | |
| 330 | empty.length ? `no pages for: ${empty.join(', ')} — getStaticPaths returned nothing, usually an empty database (run \`./buddy seed\`)` : '', | |
| 331 | ) | |
| 332 | } | |
| 333 | ||
| 302 | 334 | // 7. The sitemap never advertises a path robots.txt forbids. |
| 303 | 335 | { |
| 304 | 336 | const sitemap = await Bun.file('dist/sitemap.xml').text() |