@piercebarney/whs-eleventy 2026.9.29 → 2026.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/compliance.js +51 -4
- package/package.json +1 -1
- package/standard/CHANGELOG.md +50 -0
- package/standard/core.md +2 -2
package/lib/compliance.js
CHANGED
|
@@ -18,7 +18,7 @@ const path = require("node:path");
|
|
|
18
18
|
const { execSync } = require("node:child_process");
|
|
19
19
|
const { parse: parseHtml } = require("node-html-parser");
|
|
20
20
|
const { runRepoChecks } = require("./doctor.js");
|
|
21
|
-
const { ROOT, resolveStandard } = require("./_project.js");
|
|
21
|
+
const { ROOT, resolveStandard, tryProjectRequire } = require("./_project.js");
|
|
22
22
|
|
|
23
23
|
const SITE = path.join(ROOT, "_site");
|
|
24
24
|
const CACHE = path.join(ROOT, ".cache", "compliance.json");
|
|
@@ -109,6 +109,28 @@ const fromDoctor = (id, extra = "", { strict = false, missingIsFail = false } =
|
|
|
109
109
|
// ---- per-chapter checks ------------------------------------------------
|
|
110
110
|
// Each returns { status, note }. Keep them mechanical; hand judgement to MANUAL.
|
|
111
111
|
|
|
112
|
+
// Used by `privacy` below: the third-party list must render from
|
|
113
|
+
// _data/thirdparties.js — either a Nunjucks `for...in` loop or a JS
|
|
114
|
+
// `.map()`/`.forEach()` iteration.
|
|
115
|
+
const THIRD_PARTY_LOOP = /for\s+t\s+in\s+thirdparties|thirdparties\s*\.\s*(?:map|forEach)\s*\(/;
|
|
116
|
+
|
|
117
|
+
function hasThirdPartyLoop() {
|
|
118
|
+
if (grepSrc(THIRD_PARTY_LOOP).length) return true;
|
|
119
|
+
// A privacy page can be a root-level template (a flat-layout adopted
|
|
120
|
+
// project's own convention, outside grepSrc's src/static/scripts roots
|
|
121
|
+
// entirely). Check top-level files at the project root too — never
|
|
122
|
+
// recursive, so node_modules/.git/etc. are never walked (readdirSync with
|
|
123
|
+
// no recursion, filtered to isFile()).
|
|
124
|
+
try {
|
|
125
|
+
return fs
|
|
126
|
+
.readdirSync(ROOT, { withFileTypes: true })
|
|
127
|
+
.filter((e) => e.isFile() && /\.(js|njk)$/.test(e.name))
|
|
128
|
+
.some((e) => THIRD_PARTY_LOOP.test(fs.readFileSync(path.join(ROOT, e.name), "utf8")));
|
|
129
|
+
} catch {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
112
134
|
const CHECKS = {
|
|
113
135
|
"repo-hygiene": () => {
|
|
114
136
|
const docs = ["README.md", "CLAUDE.md"].filter((f) => has(f));
|
|
@@ -445,14 +467,39 @@ const CHECKS = {
|
|
|
445
467
|
// The privacy page may be a standalone src/privacy.njk or a pages.json
|
|
446
468
|
// entry rendered by a src/pages/ shell — check the built output, with a
|
|
447
469
|
// source fallback for when _site isn't built yet.
|
|
448
|
-
const
|
|
470
|
+
const builtPath = has("_site/privacy/index.html")
|
|
471
|
+
? "_site/privacy/index.html"
|
|
472
|
+
: has("_site/privacy.html")
|
|
473
|
+
? "_site/privacy.html"
|
|
474
|
+
: null;
|
|
449
475
|
const source =
|
|
450
476
|
has("src/privacy.njk") ||
|
|
451
477
|
/["']slug["']\s*:\s*["']privacy["']/.test(read("src/content/pages.json") || "");
|
|
452
|
-
if (!
|
|
478
|
+
if (!builtPath && !source) return { status: FAIL, note: "no privacy page" };
|
|
479
|
+
|
|
480
|
+
// Prefer checking the built page's own rendered HTML for every declared
|
|
481
|
+
// third party's name — what a user actually sees, independent of which
|
|
482
|
+
// source file or templating approach produced it. Falls back to the
|
|
483
|
+
// source-level pattern only when there's no built output yet, or
|
|
484
|
+
// nothing declared to check against.
|
|
485
|
+
if (builtPath) {
|
|
486
|
+
const thirdparties = tryProjectRequire("src/_data/thirdparties.js", null);
|
|
487
|
+
if (Array.isArray(thirdparties) && thirdparties.length) {
|
|
488
|
+
const html = read(builtPath) || "";
|
|
489
|
+
const missing = thirdparties
|
|
490
|
+
.filter((t) => t?.name && !html.includes(t.name))
|
|
491
|
+
.map((t) => t.name);
|
|
492
|
+
return missing.length
|
|
493
|
+
? { status: FAIL, note: `privacy page missing disclosure for: ${missing.join(", ")}` }
|
|
494
|
+
: {
|
|
495
|
+
status: PASS,
|
|
496
|
+
note: "privacy page present; built output discloses every declared third party",
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
}
|
|
453
500
|
// The third-party disclosure must be generated from _data/thirdparties.js,
|
|
454
501
|
// never hand-maintained — the loop lives in the privacy shell or an include.
|
|
455
|
-
if (
|
|
502
|
+
if (!hasThirdPartyLoop())
|
|
456
503
|
return {
|
|
457
504
|
status: FAIL,
|
|
458
505
|
note: "privacy third-party list not rendered from _data/thirdparties.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piercebarney/whs-eleventy",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.10.1",
|
|
4
4
|
"description": "The web house style's Eleventy + Netlify tooling — the compliance sweep, the infra doctor, the link/CSP integrity check, and the a11y scan, shared by every project on the stack.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"whs": "cli.js"
|
package/standard/CHANGELOG.md
CHANGED
|
@@ -21,6 +21,56 @@ enforced, new *opt-in* chapters/capabilities, tooling-only changes — is
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
+
## 2026-10-01 [non-breaking]
|
|
25
|
+
|
|
26
|
+
### packages/whs-eleventy
|
|
27
|
+
|
|
28
|
+
Supersedes yesterday's (2026-09-30) `hasThirdPartyLoop()` widening, which was
|
|
29
|
+
correct but unreachable: the standard's own reference `audit.njk` template
|
|
30
|
+
independently contains a matching loop pattern for its unrelated Content &
|
|
31
|
+
Links tab, so `privacy`'s broad source scan always found that coincidental
|
|
32
|
+
match first, before the new fallback logic could ever run — this affected
|
|
33
|
+
every project descended from the template, not just the one that reported
|
|
34
|
+
it. `privacy` in `lib/compliance.js` now checks the built privacy page's own
|
|
35
|
+
rendered HTML for every third party declared in `src/_data/thirdparties.js`,
|
|
36
|
+
by name — what a user actually sees, independent of which source file or
|
|
37
|
+
templating syntax produced it — falling back to yesterday's source-pattern
|
|
38
|
+
mechanism (unchanged, still present) only when there's no built output yet
|
|
39
|
+
or nothing is declared to check against. Confirmed against the reference
|
|
40
|
+
template itself: `privacy` still PASSes, now for the correct reason (built
|
|
41
|
+
output discloses every declared party) instead of the coincidental
|
|
42
|
+
`audit.njk` match. Resolves
|
|
43
|
+
`feedback/2026-09-23-privacy-thirdparty-check-scans-wrong-file.md` (the
|
|
44
|
+
original report) and
|
|
45
|
+
`feedback/2026-09-24-privacy-thirdparty-fix-still-short-circuits-on-audit-loop.md`
|
|
46
|
+
(the follow-up that diagnosed why the 2026-09-30 fix didn't work). Fixed in
|
|
47
|
+
`56f5c67`.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2026-09-30 [non-breaking]
|
|
52
|
+
|
|
53
|
+
### packages/whs-eleventy
|
|
54
|
+
|
|
55
|
+
`privacy` in `lib/compliance.js`'s third-party-loop gate
|
|
56
|
+
(`grepSrc(/for\s+t\s+in\s+thirdparties/)`) only recognized Nunjucks
|
|
57
|
+
`for...in` syntax and only scanned `src/`, `static/`, `scripts/` — so a
|
|
58
|
+
root-level, JS-class (`.11ty.js`) privacy page rendering its disclosure list
|
|
59
|
+
via `.map()`/`.forEach()` could pass only by coincidence, via an unrelated
|
|
60
|
+
file elsewhere in the scanned roots happening to contain a matching Nunjucks
|
|
61
|
+
loop. Now also recognizes `.map()`/`.forEach()` iteration, and falls back to
|
|
62
|
+
a non-recursive scan of top-level project-root files when the shared scan
|
|
63
|
+
finds nothing. This resolves the concrete reported case — the check now
|
|
64
|
+
reaches and validates the actual root-level privacy page's own rendering
|
|
65
|
+
instead of passing via a coincidental match — without claiming full
|
|
66
|
+
precision: Eleventy supports too many valid page-rendering shapes for the
|
|
67
|
+
check to reliably identify "the one file that renders this page" in general.
|
|
68
|
+
Local to `privacy`; `grepSrc`'s shared defaults and its other six call sites
|
|
69
|
+
are untouched. Resolves
|
|
70
|
+
`feedback/2026-09-23-privacy-thirdparty-check-scans-wrong-file.md`.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
24
74
|
## 2026-09-29 [non-breaking]
|
|
25
75
|
|
|
26
76
|
### packages/whs-eleventy
|
package/standard/core.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Web project house style — CORE (stack-agnostic)
|
|
2
2
|
|
|
3
|
-
**Version:** 2026-
|
|
3
|
+
**Version:** 2026-10-01 · **Status:** active
|
|
4
4
|
|
|
5
5
|
This is the stack-agnostic contract every web project follows, regardless of
|
|
6
6
|
framework, host, or CSS system. It says **what** must be true, with concrete
|
|
@@ -1467,7 +1467,7 @@ governs it and follow that chapter — the slugs are the index (a `<script>` →
|
|
|
1467
1467
|
- production-url: https://example.com
|
|
1468
1468
|
- content-type: tool # tool | article (article => feeds)
|
|
1469
1469
|
- publishing-rate: ~5 pages/week
|
|
1470
|
-
- standard-version: 2026-
|
|
1470
|
+
- standard-version: 2026-10-01 # recommended — enables standard-version drift tracking (#compliance)
|
|
1471
1471
|
```
|
|
1472
1472
|
|
|
1473
1473
|
If the section is absent, the assistant's first action is to run the flow above
|