@domandigital/create-site 0.11.3 → 0.12.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @domandigital/create-site
2
2
 
3
+ ## 0.12.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7534441: The protected-preview gate matches Access destination hosts without building a regular expression from registry data, so semgrep's `detect-non-literal-regexp` rule no longer blocks the pull request of every site that installs the gate. Matching is unchanged.
8
+
9
+ ## 0.12.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 3b5a7ed: Handover mode no longer lists pages a handed-over site does not have. The generated route policy now adds its press, legal and resources entries only when that piece is installed: every piece in a new build, and only the pieces named with `--with` in a handover. A handover with no `--with` no longer gets a `/press` entry that failed the site's sitemap coverage check. Programme builds are unchanged.
14
+
15
+ ## 0.12.0
16
+
17
+ ### Minor Changes
18
+
19
+ - e51ab59: A site cannot be started without passing its programme. A real run now calls `dd-programme gate` (Stage 05 accepted) and refuses, writing nothing, when it fails or when dd-programme is not installed. `--no-gate` (or `DD_CREATE_SITE_NO_GATE=1`, for the nightly starter job) skips it and the start label records the skip.
20
+
21
+ New `.dd/site-start.json` says how the site was started: `mode`, `programme`, the gate result and, for a handover, the reason and the visible pieces added. It describes the site; the proof is `create-site --check` passing.
22
+
23
+ New `--handover --reason "..." --programme DOM-123 [--with credit,consent,analytics,legal,press,resources]` starts an existing live site copied in as Astro. It adds the invisible layers only (facts, routes, redirects, JSON-LD, SEO tests, gates) and keeps the client's look and copy. In handover mode the build blocks on facts, reports the direction and mobile-first checks without stopping, and skips tokens, night contrast, the copy deck and the null check. A visible piece is added only when named in `--with`. `--check` keeps the mode from the label.
24
+
25
+ `site.programme.json` gains `mode`.
26
+
27
+ ### Patch Changes
28
+
29
+ - 0936ad3: The protected preview guard accepts the registered allow_outside_domain addresses: the live Access policy must be the reviewers group plus exactly those addresses, each with a reason. Any other address, bypass, service token or bare allow still fails.
30
+
3
31
  ## 0.11.3
4
32
 
5
33
  ### Patch Changes
package/README.md CHANGED
@@ -119,6 +119,28 @@ The gate scripts are house files, identical on every site and reported by
119
119
  `--check` when they drift. Everything that differs between sites is in
120
120
  `site.programme.json`.
121
121
 
122
+ ## Starting is mandatory: the programme gate, the label and handover
123
+
124
+ A real run first asks `dd-programme gate DOM-123 --stage 05`, so nothing is scaffolded before the
125
+ programme has accepted Stage 05. If the gate fails, or `dd-programme` is not installed, the run is refused and writes
126
+ nothing. `--no-gate` (or `DD_CREATE_SITE_NO_GATE=1`, which the nightly starter job uses) skips it; the label records the skip.
127
+
128
+ `.dd/site-start.json` says how the site was started: `mode` (`programme` or `handover`), the programme issue, the
129
+ gate result, and for a handover the reason and the visible pieces added. It describes; it is not the proof. The proof is
130
+ `create-site --check` passing, which the estate sweep in dd-repo-registry runs against every site, in any GitHub account.
131
+
132
+ A site copied in from a client's live build is started with:
133
+
134
+ ```bash
135
+ create-site --handover --reason "client's existing Astro site, copied in" --programme DOM-123
136
+ ```
137
+
138
+ It adds the invisible layers only: the facts file, routes, redirects, JSON-LD, the SEO tests and the gates. It keeps the client's
139
+ look and copy. The build then blocks on `facts.mjs`, reports `check-direction.mjs` and `mobile-first.mjs` without stopping, and skips tokens,
140
+ night contrast, the copy deck and the null check. Nothing a visitor can see is added until the founder says yes for that site; then
141
+ re-run with `--with credit,consent,analytics,legal,press,resources` for the pieces agreed. `--check` reads the mode from the label.
142
+ Capture the live site's claims with `dd-claims` before anything else changes.
143
+
122
144
  ## What it never does
123
145
 
124
146
  - Write outside the project, or anything at all when it refuses.
@@ -139,7 +161,7 @@ The gate scripts are house files, identical on every site and reported by
139
161
  create-site [dir] [--client <legal name>] [--trading-name <name>]
140
162
  [--site-url <https://...>] [--sector trades|beauty|clinics|professional]
141
163
  [--description "<one or two sentences>"] [--programme DOM-123]
142
- [--answers <file.json>]
164
+ [--answers <file.json>] [--handover --reason "<why>" [--with <pieces>]] [--no-gate]
143
165
  [--visibility private|public] [--dry-run] [--check] [--force]
144
166
  [--skip-install] [--yes] [--help] [--version]
145
167
  ```
package/dist/cli.js CHANGED
@@ -6,11 +6,11 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // src/cli.ts
9
- import { execFileSync } from "child_process";
9
+ import { execFileSync, spawnSync } from "child_process";
10
10
  import { createInterface } from "readline/promises";
11
11
 
12
12
  // src/run.ts
13
- import { readFileSync as readFileSync6 } from "fs";
13
+ import { readFileSync as readFileSync7 } from "fs";
14
14
  import { resolve as resolve2 } from "path";
15
15
 
16
16
  // src/answers.ts
@@ -269,6 +269,31 @@ function applyPlan(plan, clientName, exec) {
269
269
 
270
270
  // src/args.ts
271
271
  import { parseArgs } from "util";
272
+
273
+ // src/handover.ts
274
+ var VISIBLE_PIECES = ["credit", "consent", "analytics", "legal", "press", "resources"];
275
+ var PIECE_FILES = {
276
+ credit: /\/DesignerCredit\.(tsx|astro)$/,
277
+ consent: /\/CookieBanner\.(tsx|astro)$/,
278
+ analytics: /\/WebAnalytics\.(tsx|astro)$/,
279
+ legal: /\/(privacy|cookies|terms|accessibility)(\/page\.tsx|\.astro)$/,
280
+ press: /\/press(\/page\.tsx|\.astro)$/,
281
+ resources: /\/resources(\/page\.tsx|\/index\.astro)$/
282
+ };
283
+ function pieceOf(template) {
284
+ const path = `/${template}`;
285
+ for (const piece of VISIBLE_PIECES) if (PIECE_FILES[piece].test(path)) return piece;
286
+ return null;
287
+ }
288
+ function pieceInstalled(piece, handover) {
289
+ return !handover || handover.with.includes(piece);
290
+ }
291
+ function installs(template, handover) {
292
+ const piece = pieceOf(template);
293
+ return piece === null || pieceInstalled(piece, handover);
294
+ }
295
+
296
+ // src/args.ts
272
297
  var USAGE = `create-site: start a Doman Digital client site on the house foundation.
273
298
 
274
299
  Run it inside a fresh Next.js (App Router) or Astro TypeScript project:
@@ -280,10 +305,23 @@ Usage
280
305
  [--site-url <https://...>] [--sector trades|beauty|clinics|professional]
281
306
  [--description "<one or two sentences>"] [--programme DOM-123]
282
307
  [--answers <file.json>] [--visibility private|public]
283
- [--dry-run] [--check] [--force] [--skip-install] [--yes] [--help] [--version]
308
+ [--handover --reason "<why>" [--with credit,consent,analytics,legal,press,resources]]
309
+ [--no-gate] [--dry-run] [--check] [--force] [--skip-install] [--yes] [--help] [--version]
284
310
 
285
311
  --programme The site's programme issue in Linear, opened from the Site programme
286
312
  template. The build refuses to run until site.programme.json names it.
313
+ A real run first passes the programme gate: Stage 05 accepted
314
+ (dd-programme gate DOM-123 --stage 05), so nothing is scaffolded early.
315
+ --handover Start an existing live site that is being copied in (an Astro handover).
316
+ Needs --programme (a Site handover programme) and --reason. It adds the
317
+ invisible layers only (facts, routes, redirects, JSON-LD, SEO tests, gates
318
+ in advisory mode) and keeps the client's look and copy. Anything a visitor
319
+ can see is added only when named in --with, one site at a time.
320
+ --with A handover's visible pieces: credit (Website by Doman Digital), consent
321
+ (cookie banner), analytics (Cloudflare Web Analytics), legal (privacy,
322
+ cookies, terms, accessibility), press, resources.
323
+ --no-gate Skip the programme gate (the nightly starter check and tests). The start
324
+ label records it, and the estate sweep does not count the site as started.
287
325
  --dry-run Print the plan and stop. Writes nothing, runs nothing.
288
326
  --check Like --dry-run, never prompts, and exits 3 when there is work to do,
289
327
  a house file that differs from its template included. For CI.
@@ -310,6 +348,10 @@ function parseOptions(argv) {
310
348
  description: { type: "string" },
311
349
  programme: { type: "string" },
312
350
  answers: { type: "string" },
351
+ handover: { type: "boolean", default: false },
352
+ reason: { type: "string" },
353
+ with: { type: "string" },
354
+ "no-gate": { type: "boolean", default: false },
313
355
  "dry-run": { type: "boolean", default: false },
314
356
  check: { type: "boolean", default: false },
315
357
  visibility: { type: "string", default: "private" },
@@ -322,6 +364,11 @@ function parseOptions(argv) {
322
364
  });
323
365
  if (positionals.length > 1) return `one directory at most, got ${positionals.length}`;
324
366
  if (values.visibility !== "private" && values.visibility !== "public") return `--visibility is private or public, not ${values.visibility}`;
367
+ const withList = values.with ? values.with.split(",").map((w) => w.trim()).filter(Boolean) : [];
368
+ const bad = withList.filter((w) => !VISIBLE_PIECES.includes(w));
369
+ if (bad.length) return `--with takes ${VISIBLE_PIECES.join(", ")}, not ${bad.join(", ")}`;
370
+ if (withList.length && !values.handover) return "--with is for --handover: a new build adds every piece";
371
+ if (values.reason && !values.handover) return "--reason is for --handover";
325
372
  return {
326
373
  dir: positionals[0],
327
374
  client: values.client,
@@ -331,6 +378,10 @@ function parseOptions(argv) {
331
378
  description: values.description,
332
379
  programme: values.programme,
333
380
  answers: values.answers,
381
+ handover: values.handover ?? false,
382
+ reason: values.reason,
383
+ with: [...new Set(withList)],
384
+ noGate: values["no-gate"] ?? false,
334
385
  dryRun: values["dry-run"] ?? false,
335
386
  check: values.check ?? false,
336
387
  visibility: values.visibility,
@@ -421,9 +472,71 @@ function detectProject(root, userAgent) {
421
472
  };
422
473
  }
423
474
 
475
+ // src/label.ts
476
+ import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
477
+ import { join as join3 } from "path";
478
+
479
+ // src/templates.ts
480
+ import { readFileSync as readFileSync4 } from "fs";
481
+ import { dirname as dirname2, posix, relative } from "path";
482
+ import { fileURLToPath } from "url";
483
+ var TEMPLATE_ROOT = fileURLToPath(new URL("../templates/", import.meta.url));
484
+ function readTemplate(path) {
485
+ return readFileSync4(`${TEMPLATE_ROOT}${path}`, "utf8");
486
+ }
487
+ var SITE_IMPORT = /(["'])~site\/([^"']+)\1/g;
488
+ function rewriteSiteImports(text2, dest, siteKeys) {
489
+ return text2.replace(SITE_IMPORT, (_match, quote, key) => {
490
+ const target = siteKeys[key];
491
+ if (!target) throw new Error(`template for ${dest} imports ~site/${key}, which this project layout does not provide`);
492
+ const fromDir = dirname2(dest);
493
+ let spec = relative(fromDir, target).split("\\").join(posix.sep).replace(/\.tsx?$/, "");
494
+ if (!spec.startsWith(".")) spec = `./${spec}`;
495
+ return `${quote}${spec}${quote}`;
496
+ });
497
+ }
498
+
499
+ // src/label.ts
500
+ var LABEL_PATH = ".dd/site-start.json";
501
+ var TOOL_NAME = "@domandigital/create-site";
502
+ function toolVersion() {
503
+ return JSON.parse(readFileSync5(`${TEMPLATE_ROOT}../package.json`, "utf8")).version;
504
+ }
505
+ function renderLabel(start, programme, today) {
506
+ const label = {
507
+ $comment: "How this site was started. A label only: the proof is `create-site --check` passing. Written by @domandigital/create-site; never replaced.",
508
+ tool: TOOL_NAME,
509
+ version: start.version,
510
+ mode: start.mode,
511
+ programme,
512
+ ...start.stage05Gate === void 0 ? {} : { stage05Gate: start.stage05Gate },
513
+ ...start.handoverGate === void 0 ? {} : { handoverGate: start.handoverGate },
514
+ ...start.mode === "handover" ? { reason: start.reason ?? null, with: start.with } : {},
515
+ startedAt: today
516
+ };
517
+ return `${JSON.stringify(label, null, 2)}
518
+ `;
519
+ }
520
+ function readLabel(root) {
521
+ const path = join3(root, LABEL_PATH);
522
+ if (!existsSync3(path)) return null;
523
+ try {
524
+ const raw = JSON.parse(readFileSync5(path, "utf8"));
525
+ const mode = raw.mode === "handover" || raw.mode === "programme" ? raw.mode : void 0;
526
+ return {
527
+ mode,
528
+ reason: typeof raw.reason === "string" ? raw.reason : void 0,
529
+ with: Array.isArray(raw.with) ? raw.with.filter((w) => typeof w === "string") : [],
530
+ programme: typeof raw.programme === "string" ? raw.programme : null
531
+ };
532
+ } catch {
533
+ return null;
534
+ }
535
+ }
536
+
424
537
  // src/plan.ts
425
- import { existsSync as existsSync5, readdirSync as readdirSync3, readFileSync as readFileSync5 } from "fs";
426
- import { join as join5 } from "path";
538
+ import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "fs";
539
+ import { join as join6 } from "path";
427
540
 
428
541
  // src/adapters.ts
429
542
  var GATES = [
@@ -677,10 +790,13 @@ export const facts: SiteFacts = {
677
790
  };
678
791
  `;
679
792
  }
680
- function renderRoutes(routesOnDisk3, dynamicRoutesOnDisk3 = []) {
681
- const routes = [.../* @__PURE__ */ new Set([...routesOnDisk3, "/press"])].filter((r) => r !== "/resources" && !LEGAL_ROUTES.includes(r)).sort();
793
+ function renderRoutes(routesOnDisk3, dynamicRoutesOnDisk3 = [], handover = null) {
794
+ const onDisk = new Set(routesOnDisk3);
795
+ const listed = (piece, path) => pieceInstalled(piece, handover) || onDisk.has(path);
796
+ const routes = [.../* @__PURE__ */ new Set([...routesOnDisk3, ...listed("press", "/press") ? ["/press"] : []])].filter((r) => r !== "/resources" && !LEGAL_ROUTES.includes(r)).sort();
682
797
  const entries = routes.map((path) => ` { path: ${JSON.stringify(path)}, indexable: true, inSitemap: true },`);
683
798
  for (const path of LEGAL_ROUTES) {
799
+ if (!listed("legal", path)) continue;
684
800
  entries.push(` { path: ${JSON.stringify(path)}, indexable: true, inSitemap: false, reason: "Legal page: linked from every page's footer, not a search landing page." },`);
685
801
  }
686
802
  const patterns = /* @__PURE__ */ new Map();
@@ -694,9 +810,9 @@ function renderRoutes(routesOnDisk3, dynamicRoutesOnDisk3 = []) {
694
810
  )} },`
695
811
  );
696
812
  }
697
- entries.push(
698
- ` { path: "/resources", indexable: false, inSitemap: false, reason: "Empty until the first linkable asset ships. Index it then." },`
699
- );
813
+ if (listed("resources", "/resources")) {
814
+ entries.push(` { path: "/resources", indexable: false, inSitemap: false, reason: "Empty until the first linkable asset ships. Index it then." },`);
815
+ }
700
816
  return `// Every page on the site, what it is trying to rank for, and how pages
701
817
  // link to each other. Add a policy entry in the same change that adds a
702
818
  // page: tests/seo/coverage.test.ts fails until you do. Every path and
@@ -755,12 +871,13 @@ function renderRedirects() {
755
871
  return `${JSON.stringify({ $schema: "./node_modules/@domandigital/seo/redirects.schema.json", redirects: [] }, null, 2)}
756
872
  `;
757
873
  }
758
- function renderProgramme(a, project) {
874
+ function renderProgramme(a, project, mode = "programme") {
759
875
  const base = project.srcBase;
760
876
  const source = base ? [base.replace(/\/$/, "")] : ["app", "components", "lib", "content"];
761
877
  const host = a.stack.host === "cloudflare" ? a.stack.host : null;
762
878
  const programme = {
763
879
  $comment: "Read by scripts/gates/ before every build and preview deploy. docs/site-programme.md says what each key is for. Written by @domandigital/create-site; yours to edit, never overwritten.",
880
+ mode,
764
881
  issue: a.programme,
765
882
  registeredDirection: null,
766
883
  paths: {
@@ -1018,38 +1135,18 @@ function patchPnpmWorkspace(text2) {
1018
1135
  ${block}` : block;
1019
1136
  }
1020
1137
 
1021
- // src/templates.ts
1022
- import { readFileSync as readFileSync4 } from "fs";
1023
- import { dirname as dirname2, posix, relative } from "path";
1024
- import { fileURLToPath } from "url";
1025
- var TEMPLATE_ROOT = fileURLToPath(new URL("../templates/", import.meta.url));
1026
- function readTemplate(path) {
1027
- return readFileSync4(`${TEMPLATE_ROOT}${path}`, "utf8");
1028
- }
1029
- var SITE_IMPORT = /(["'])~site\/([^"']+)\1/g;
1030
- function rewriteSiteImports(text2, dest, siteKeys) {
1031
- return text2.replace(SITE_IMPORT, (_match, quote, key) => {
1032
- const target = siteKeys[key];
1033
- if (!target) throw new Error(`template for ${dest} imports ~site/${key}, which this project layout does not provide`);
1034
- const fromDir = dirname2(dest);
1035
- let spec = relative(fromDir, target).split("\\").join(posix.sep).replace(/\.tsx?$/, "");
1036
- if (!spec.startsWith(".")) spec = `./${spec}`;
1037
- return `${quote}${spec}${quote}`;
1038
- });
1039
- }
1040
-
1041
1138
  // templates/next/tests/seo/routes-on-disk.ts
1042
1139
  var routes_on_disk_exports = {};
1043
1140
  __export(routes_on_disk_exports, {
1044
1141
  dynamicRoutesOnDisk: () => dynamicRoutesOnDisk,
1045
1142
  routesOnDisk: () => routesOnDisk
1046
1143
  });
1047
- import { existsSync as existsSync3, readdirSync } from "fs";
1048
- import { join as join3 } from "path";
1144
+ import { existsSync as existsSync4, readdirSync } from "fs";
1145
+ import { join as join4 } from "path";
1049
1146
  var PAGE_FILE = /^page\.(tsx|ts|jsx|js|mdx|md)$/;
1050
1147
  var OPTIONAL_CATCH_ALL2 = /^\[\[\.\.\..+\]\]$/;
1051
1148
  function walk(root) {
1052
- const appDir = [join3(root, "app"), join3(root, "src", "app")].find((dir) => existsSync3(dir));
1149
+ const appDir = [join4(root, "app"), join4(root, "src", "app")].find((dir) => existsSync4(dir));
1053
1150
  const routes = /* @__PURE__ */ new Set();
1054
1151
  const dynamicRoutes = /* @__PURE__ */ new Set();
1055
1152
  if (!appDir) return { routes: [], dynamicRoutes: [] };
@@ -1059,7 +1156,7 @@ function walk(root) {
1059
1156
  if (entry.isDirectory()) {
1060
1157
  if (name.startsWith("_") || name.startsWith("@") || name.startsWith("(.")) continue;
1061
1158
  const isGroup = name.startsWith("(") && name.endsWith(")");
1062
- visit(join3(dir, name), isGroup ? segments : [...segments, name]);
1159
+ visit(join4(dir, name), isGroup ? segments : [...segments, name]);
1063
1160
  } else if (PAGE_FILE.test(name)) {
1064
1161
  const path = `/${segments.join("/")}`;
1065
1162
  const firstDynamic = segments.findIndex((s) => s.startsWith("["));
@@ -1088,21 +1185,21 @@ __export(routes_on_disk_exports2, {
1088
1185
  dynamicRoutesOnDisk: () => dynamicRoutesOnDisk2,
1089
1186
  routesOnDisk: () => routesOnDisk2
1090
1187
  });
1091
- import { existsSync as existsSync4, readdirSync as readdirSync2 } from "fs";
1092
- import { join as join4 } from "path";
1188
+ import { existsSync as existsSync5, readdirSync as readdirSync2 } from "fs";
1189
+ import { join as join5 } from "path";
1093
1190
  var PAGE_FILE2 = /^(.+)\.(astro|md|mdx|html)$/;
1094
1191
  var NOT_PAGES = /* @__PURE__ */ new Set(["404", "500"]);
1095
1192
  function walk2(root) {
1096
- const pagesDir = join4(root, "src", "pages");
1193
+ const pagesDir = join5(root, "src", "pages");
1097
1194
  const routes = /* @__PURE__ */ new Set();
1098
1195
  const dynamicRoutes = /* @__PURE__ */ new Set();
1099
- if (!existsSync4(pagesDir)) return { routes: [], dynamicRoutes: [] };
1196
+ if (!existsSync5(pagesDir)) return { routes: [], dynamicRoutes: [] };
1100
1197
  const visit = (dir, segments) => {
1101
1198
  for (const entry of readdirSync2(dir, { withFileTypes: true })) {
1102
1199
  const name = entry.name;
1103
1200
  if (name.startsWith("_")) continue;
1104
1201
  if (entry.isDirectory()) {
1105
- visit(join4(dir, name), [...segments, name]);
1202
+ visit(join5(dir, name), [...segments, name]);
1106
1203
  continue;
1107
1204
  }
1108
1205
  const match = PAGE_FILE2.exec(name);
@@ -1134,21 +1231,21 @@ var PM_ADD = {
1134
1231
  var HOUSE_IMPORT = "@docs/HOUSE.md";
1135
1232
  var specs = (deps) => Object.entries(deps).map(([name, range]) => `${name}@${range}`);
1136
1233
  function hasWorkflows(root) {
1137
- const dir = join5(root, ".github", "workflows");
1138
- return existsSync5(dir) && readdirSync3(dir).some((f) => /\.ya?ml$/.test(f));
1234
+ const dir = join6(root, ".github", "workflows");
1235
+ return existsSync6(dir) && readdirSync3(dir).some((f) => /\.ya?ml$/.test(f));
1139
1236
  }
1140
1237
  function programmeIssueIn(root) {
1141
1238
  try {
1142
- const issue = JSON.parse(readFileSync5(join5(root, "site.programme.json"), "utf8")).issue;
1239
+ const issue = JSON.parse(readFileSync6(join6(root, "site.programme.json"), "utf8")).issue;
1143
1240
  return typeof issue === "string" && issue ? issue : null;
1144
1241
  } catch {
1145
1242
  return null;
1146
1243
  }
1147
1244
  }
1148
1245
  function actionFor(root, path, contents, data, force) {
1149
- const abs = join5(root, path);
1150
- if (!existsSync5(abs)) return "create";
1151
- if (readFileSync5(abs, "utf8") === contents) return "unchanged";
1246
+ const abs = join6(root, path);
1247
+ if (!existsSync6(abs)) return "create";
1248
+ if (readFileSync6(abs, "utf8") === contents) return "unchanged";
1152
1249
  if (data) return "keep-data";
1153
1250
  return force ? "overwrite" : "skip-exists";
1154
1251
  }
@@ -1161,7 +1258,14 @@ function planScaffold(project, answers, options) {
1161
1258
  "hand docs/client-facts.entry.json to Doman Digital's client register, and fill every null in it first (the register's own check names them)."
1162
1259
  );
1163
1260
  const files = [];
1261
+ const start = options.start ?? { mode: "programme", with: [], version: "0.0.0" };
1262
+ const handover = start.mode === "handover" ? { with: start.with } : null;
1263
+ if (handover) {
1264
+ const left = VISIBLE_PIECES.filter((p) => !start.with.includes(p));
1265
+ if (left.length) notes.push(`handover: nothing a visitor can see was added (${left.join(", ")}). Each needs the founder's yes for this site, then --with <piece>.`);
1266
+ }
1164
1267
  for (const t of layout.templates) {
1268
+ if (!installs(t.template, handover)) continue;
1165
1269
  if (t.template.endsWith("config.test.ts") && !project.configFile) {
1166
1270
  notes.push(`no ${project.framework} config file, so tests/seo/config.test.ts was not written: ${MANUAL_INSTRUCTIONS[project.framework]}`);
1167
1271
  continue;
@@ -1172,7 +1276,7 @@ function planScaffold(project, answers, options) {
1172
1276
  const enumerate = project.framework === "next" ? routes_on_disk_exports : routes_on_disk_exports2;
1173
1277
  files.push(
1174
1278
  { path: "site.facts.ts", contents: renderFacts(answers, adapterSpec), data: true },
1175
- { path: "site.routes.ts", contents: renderRoutes(enumerate.routesOnDisk(root), enumerate.dynamicRoutesOnDisk(root)), data: true },
1279
+ { path: "site.routes.ts", contents: renderRoutes(enumerate.routesOnDisk(root), enumerate.dynamicRoutesOnDisk(root), handover), data: true },
1176
1280
  { path: "links.json", contents: renderLinks(), data: true },
1177
1281
  { path: "redirects.json", contents: renderRedirects(), data: true },
1178
1282
  { path: "docs/HOUSE.md", contents: renderHouseMd(answers, project), data: false },
@@ -1180,7 +1284,8 @@ function planScaffold(project, answers, options) {
1180
1284
  { path: "docs/seo-launch-checklist.md", contents: renderChecklist(answers), data: true },
1181
1285
  { path: "docs/seo-baseline.md", contents: renderBaseline(answers, options.today), data: true },
1182
1286
  { path: "docs/client-facts.entry.json", contents: renderStackEntry(answers, project.framework, options.today), data: true },
1183
- { path: "site.programme.json", contents: renderProgramme(answers, project), data: true },
1287
+ { path: "site.programme.json", contents: renderProgramme(answers, project, start.mode), data: true },
1288
+ { path: LABEL_PATH, contents: renderLabel(start, answers.programme ?? programmeIssueIn(root), options.today), data: true },
1184
1289
  { path: "art-direction.sheets.json", contents: renderSheets(), data: true }
1185
1290
  );
1186
1291
  if (!answers.programme && !programmeIssueIn(root)) {
@@ -1188,7 +1293,7 @@ function planScaffold(project, answers, options) {
1188
1293
  }
1189
1294
  const workflowPath = ".github/workflows/seo-check.yml";
1190
1295
  const workflow = renderWorkflow(project, options.visibility ?? "private");
1191
- if (existsSync5(join5(root, workflowPath)) || workflow && !hasWorkflows(root)) {
1296
+ if (existsSync6(join6(root, workflowPath)) || workflow && !hasWorkflows(root)) {
1192
1297
  if (workflow) files.push({ path: workflowPath, contents: workflow, data: false });
1193
1298
  } else if (!workflow) {
1194
1299
  notes.push(`no CI workflow written for ${project.packageManager}: run seo:check in your CI`);
@@ -1228,25 +1333,25 @@ function planScaffold(project, answers, options) {
1228
1333
  }
1229
1334
  let config = null;
1230
1335
  if (project.configFile) {
1231
- const patched = patchConfig(project.framework, project.configFile, readFileSync5(join5(root, project.configFile), "utf8"));
1336
+ const patched = patchConfig(project.framework, project.configFile, readFileSync6(join6(root, project.configFile), "utf8"));
1232
1337
  if (patched.kind === "patched") config = { file: project.configFile, text: patched.text };
1233
1338
  if (patched.kind === "manual") notes.push(`${patched.reason}: ${MANUAL_INSTRUCTIONS[project.framework]}. tests/seo/config.test.ts fails until it does.`);
1234
1339
  }
1235
1340
  let pnpmWorkspace = null;
1236
1341
  if (project.packageManager === "pnpm") {
1237
- const path = join5(root, "pnpm-workspace.yaml");
1238
- const current = existsSync5(path) ? readFileSync5(path, "utf8") : null;
1342
+ const path = join6(root, "pnpm-workspace.yaml");
1343
+ const current = existsSync6(path) ? readFileSync6(path, "utf8") : null;
1239
1344
  const text2 = patchPnpmWorkspace(current);
1240
1345
  if (text2 !== null) pnpmWorkspace = { text: text2, created: current === null };
1241
1346
  }
1242
- const claudePath = join5(root, "CLAUDE.md");
1243
- const claudeText = existsSync5(claudePath) ? readFileSync5(claudePath, "utf8") : null;
1347
+ const claudePath = join6(root, "CLAUDE.md");
1348
+ const claudeText = existsSync6(claudePath) ? readFileSync6(claudePath, "utf8") : null;
1244
1349
  const claudeMd = claudeText === null ? { text: `${HOUSE_IMPORT}
1245
1350
  `, created: true } : claudeText.includes(HOUSE_IMPORT) ? null : { text: `${claudeText.trimEnd()}
1246
1351
  ${HOUSE_IMPORT}
1247
1352
  `, created: false };
1248
- const artDirection = existsSync5(join5(root, "art-direction.json"));
1249
- const craftInstalled = existsSync5(join5(root, "node_modules", "@domandigital", "craft", "package.json"));
1353
+ const artDirection = existsSync6(join6(root, "art-direction.json"));
1354
+ const craftInstalled = existsSync6(join6(root, "node_modules", "@domandigital", "craft", "package.json"));
1250
1355
  const craftInit = !artDirection && (craftInstalled || commands.length > 0);
1251
1356
  if (!artDirection && !craftInit) notes.push(`after installing, run: npx craft direction init --client ${JSON.stringify(answers.tradingName)}`);
1252
1357
  return {
@@ -1315,7 +1420,7 @@ ${USAGE}`);
1315
1420
  return 0;
1316
1421
  }
1317
1422
  if (options.version) {
1318
- io.out(JSON.parse(readFileSync6(`${TEMPLATE_ROOT}../package.json`, "utf8")).version);
1423
+ io.out(JSON.parse(readFileSync7(`${TEMPLATE_ROOT}../package.json`, "utf8")).version);
1319
1424
  return 0;
1320
1425
  }
1321
1426
  const root = resolve2(io.cwd, options.dir ?? ".");
@@ -1341,8 +1446,52 @@ ${USAGE}`);
1341
1446
  io.err(`create-site: ${answers}`);
1342
1447
  return 2;
1343
1448
  }
1449
+ const existing = readLabel(root);
1450
+ const handover = options.handover || existing?.mode === "handover";
1451
+ const reason = options.reason ?? existing?.reason;
1452
+ const withPieces = options.handover ? options.with : existing?.with ?? [];
1453
+ const programme = answers.programme ?? programmeIssueIn(root);
1454
+ const readOnly = options.check || options.dryRun;
1455
+ if (handover && !readOnly) {
1456
+ if (!reason || reason.trim().length < 10) {
1457
+ io.err('create-site: --handover needs --reason "<why this site is copied in, in a sentence>".');
1458
+ return 2;
1459
+ }
1460
+ if (!programme) {
1461
+ io.err("create-site: --handover needs --programme DOM-123, the Site handover programme in Linear.");
1462
+ return 2;
1463
+ }
1464
+ }
1465
+ let gateResult;
1466
+ if (!readOnly && !existing) {
1467
+ const kind = handover ? "handover" : "stage05";
1468
+ if (options.noGate || io.noGateEnv === "1") {
1469
+ gateResult = false;
1470
+ io.err(`create-site: --no-gate skips the programme gate. The start label records it, and the estate sweep does not count this site as started.`);
1471
+ } else if (!programme) {
1472
+ io.err("create-site: name the programme with --programme DOM-123. Nothing is scaffolded before the programme gate passes.");
1473
+ return 1;
1474
+ } else if (!io.gate) {
1475
+ io.err(`create-site: cannot run the programme gate here (dd-programme is not installed). Run it where dd-programme is, or pass --no-gate and accept that the site is not counted as started.`);
1476
+ return 1;
1477
+ } else {
1478
+ const result = await io.gate(programme, kind);
1479
+ if (!result.ok) {
1480
+ io.err(`create-site: the programme gate for ${programme} did not pass, so nothing was written.
1481
+ ${result.message}`);
1482
+ return 1;
1483
+ }
1484
+ gateResult = true;
1485
+ }
1486
+ }
1487
+ const start = {
1488
+ mode: handover ? "handover" : "programme",
1489
+ ...handover ? { reason: reason?.trim(), handoverGate: gateResult } : { stage05Gate: gateResult },
1490
+ with: withPieces.filter((w) => VISIBLE_PIECES.includes(w)),
1491
+ version: toolVersion()
1492
+ };
1344
1493
  const today = io.now().toISOString().slice(0, 10);
1345
- const plan = planScaffold(project, answers, { force: options.force, skipInstall: options.skipInstall, today, visibility: options.visibility });
1494
+ const plan = planScaffold(project, answers, { force: options.force, skipInstall: options.skipInstall, today, visibility: options.visibility, start });
1346
1495
  io.out(formatPlan(plan, answers.tradingName));
1347
1496
  if (options.check) {
1348
1497
  const work = pendingWork(plan);
@@ -1357,6 +1506,23 @@ ${work.map((w) => ` ${w}`).join("\n")}`);
1357
1506
  if (options.dryRun || !hasWork(plan)) return 0;
1358
1507
  const pending = applyPlan(plan, answers.tradingName, io.exec);
1359
1508
  const pm = project.packageManager === "npm" ? "npm run" : project.packageManager;
1509
+ if (handover) {
1510
+ io.out(
1511
+ [
1512
+ "",
1513
+ "Next (handover):",
1514
+ " 1. Fill in site.facts.ts from the live site: contact details, hours, accreditations, profiles. Unknown stays null.",
1515
+ " 2. Capture the live site's claims with dd-claims before anything else changes; keep every one.",
1516
+ " 3. Put <JsonLd graph={buildPageGraph(...)} /> on every page. That is invisible to visitors.",
1517
+ " 4. Redirects: every old URL that moved goes in redirects.json; run seo:check.",
1518
+ " 5. The build runs in handover mode: facts is blocking; the direction and mobile-first checks report only.",
1519
+ " Anything a visitor can see (credit, cookie banner, analytics, legal pages, /press, /resources) needs the founder's yes",
1520
+ " for this site, then re-run with --with <piece>.",
1521
+ ...pending.map((p) => ` Still to run: ${p}`)
1522
+ ].join("\n")
1523
+ );
1524
+ return 0;
1525
+ }
1360
1526
  io.out(
1361
1527
  [
1362
1528
  "",
@@ -1382,6 +1548,9 @@ process.stdout.on("error", (error) => {
1382
1548
  if (error.code === "EPIPE") process.exit(process.exitCode ?? 0);
1383
1549
  throw error;
1384
1550
  });
1551
+ function hasProgrammeTool() {
1552
+ return spawnSync("dd-programme", ["--help"], { stdio: "ignore" }).status === 0;
1553
+ }
1385
1554
  var interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
1386
1555
  var rl = interactive ? createInterface({ input: process.stdin, output: process.stdout }) : void 0;
1387
1556
  void run2(process.argv.slice(2), {
@@ -1396,7 +1565,13 @@ void run2(process.argv.slice(2), {
1396
1565
  execFileSync(cmd, args, { cwd, stdio: "inherit", shell: process.platform === "win32" && cmd !== process.execPath });
1397
1566
  },
1398
1567
  now: () => /* @__PURE__ */ new Date(),
1399
- userAgent: process.env.npm_config_user_agent
1568
+ gate: hasProgrammeTool() ? async (programme, kind) => {
1569
+ const args = kind === "handover" ? ["gate", programme, "--handover"] : ["gate", programme, "--stage", "05"];
1570
+ const result = spawnSync("dd-programme", args, { encoding: "utf8" });
1571
+ return { ok: result.status === 0, message: `${result.stdout ?? ""}${result.stderr ?? ""}`.trim() };
1572
+ } : void 0,
1573
+ userAgent: process.env.npm_config_user_agent,
1574
+ noGateEnv: process.env.DD_CREATE_SITE_NO_GATE
1400
1575
  }).then((code) => {
1401
1576
  process.exitCode = code;
1402
1577
  }).finally(() => rl?.close());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domandigital/create-site",
3
- "version": "0.11.3",
3
+ "version": "0.12.2",
4
4
  "private": false,
5
5
  "description": "The first thing that runs on a new Doman Digital client site: installs the house packages and writes the per-site files they read (the facts file, route policy, backlink register, redirects, JSON-LD, the designer credit, house docs and the SEO checks), so every build starts on the same foundation and stays upgradeable by bumping packages.",
6
6
  "license": "Apache-2.0",
@@ -42,8 +42,8 @@
42
42
  "typescript": "^5.6.3",
43
43
  "vitest": "^4.0.0",
44
44
  "@domandigital/craft": "^0.24.3",
45
- "@domandigital/seo": "^0.3.2",
46
- "@domandigital/graph": "^0.7.1"
45
+ "@domandigital/graph": "^0.7.1",
46
+ "@domandigital/seo": "^0.3.2"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public",
@@ -93,6 +93,18 @@ the governed file holds. `apps/site/scripts/facts.ts` in Doman-Digital is the
93
93
  worked example: it imports `docs/brand-facts.json` and the marketing app's
94
94
  pricing modules and writes the facts the redesign renders.
95
95
 
96
+ ## Handover sites
97
+
98
+ A site copied in from a client's live build is started with `create-site --handover` and has
99
+ `"mode": "handover"` in `site.programme.json` and `.dd/site-start.json`. It keeps the client's look and
100
+ copy, so the build runs differently:
101
+
102
+ - `facts.mjs` still blocks the build.
103
+ - `check-direction.mjs` and `mobile-first.mjs` report and never stop it.
104
+ - `tokens.mjs`, `night-contrast.mjs`, `copy-deck.mjs` and `null-check.mjs` do not run.
105
+ - Nothing a visitor can see is added unless the founder said yes for this site: re-run with
106
+ `--with credit,consent,analytics,legal,press,resources` for the pieces agreed.
107
+
96
108
  ## site.programme.json
97
109
 
98
110
  | Key | What it is |
@@ -11,6 +11,13 @@ import { spawnSync } from "node:child_process";
11
11
  import { join } from "node:path";
12
12
  import { programme, root, stop } from "./programme.mjs";
13
13
 
14
+ // A handover (an existing live site copied in) keeps the client's look and copy.
15
+ // Facts still block the build. The direction and mobile-first checks report and
16
+ // never stop it. Tokens, night contrast, the copy deck and the null check do not
17
+ // run: they build a new design, and the design is the client's.
18
+ const HANDOVER_BLOCKING = [["facts.mjs"]];
19
+ const HANDOVER_ADVISORY = [["check-direction.mjs"], ["mobile-first.mjs"]];
20
+
14
21
  const GATES = [
15
22
  ["check-direction.mjs"],
16
23
  ["tokens.mjs"],
@@ -22,11 +29,26 @@ const GATES = [
22
29
  ];
23
30
 
24
31
  // Stage 01: the site has a programme in Linear before anything is built.
25
- const { issue } = programme();
32
+ const { issue, mode } = programme();
26
33
  if (typeof issue !== "string" || !/^[A-Z]+-\d+$/.test(issue)) {
27
34
  stop("programme", "01", "site.programme.json names no programme issue. Open the programme from the Site programme template in Linear and put its id (DOM-123) in issue.");
28
35
  }
29
36
 
37
+ if (mode === "handover") {
38
+ for (const [script, ...args] of HANDOVER_ADVISORY) {
39
+ const run = spawnSync(process.execPath, [join(root, "scripts", "gates", script), ...args], { cwd: root, stdio: "inherit" });
40
+ if (run.status !== 0) console.error(`\nHandover: ${script} reports a problem. It does not stop this build; docs/site-programme.md says what it checks.`);
41
+ }
42
+ for (const [script, ...args] of HANDOVER_BLOCKING) {
43
+ const run = spawnSync(process.execPath, [join(root, "scripts", "gates", script), ...args], { cwd: root, stdio: "inherit" });
44
+ if (run.status !== 0) {
45
+ console.error(`\nThe build stops at ${script}. docs/site-programme.md says what it needs.`);
46
+ process.exit(run.status || 1);
47
+ }
48
+ }
49
+ process.exit(0);
50
+ }
51
+
30
52
  for (const [script, ...args] of GATES) {
31
53
  const run = spawnSync(process.execPath, [join(root, "scripts", "gates", script), ...args], { cwd: root, stdio: "inherit" });
32
54
  if (run.status !== 0) {
@@ -72,11 +72,25 @@ export function validateProtectedConfig(wrangler, protection) {
72
72
  return protection;
73
73
  }
74
74
 
75
+ // Registered named exceptions: exact lower-case addresses, each with a reason.
76
+ export function outsideAddresses(gate) {
77
+ const rows = gate.allow_outside_domain ?? [];
78
+ if (!Array.isArray(rows)) fail("allow_outside_domain must be a list");
79
+ const emails = rows.map(row => {
80
+ if (!row || typeof row.email !== "string" || row.email !== row.email.toLowerCase() || !/^[^\s@*]+@[^\s@*]+\.[^\s@*]+$/.test(row.email)) fail("each allow_outside_domain entry needs one exact lower-case email");
81
+ if (typeof row.why !== "string" || !row.why.trim()) fail(`allow_outside_domain ${row.email} has no reason`);
82
+ return row.email;
83
+ });
84
+ if (new Set(emails).size !== emails.length) fail("allow_outside_domain repeats an address");
85
+ return emails.sort();
86
+ }
87
+
75
88
  export function canonicalReviewers(protection, registry) {
76
89
  const gate = registry.gates?.[protection.gateKey];
77
90
  if (!gate || !gate.worker || gate.worker !== protection.workerName || gate.account !== protection.accountId || gate.app !== protection.appName || `${gate.team}.cloudflareaccess.com` !== protection.teamDomain || !same(gate.hosts, [protection.hostname]) || gate.session !== "24h") fail("settings do not match the merged canonical Access registry");
78
91
  const groups = [...new Set([...(registry.default_groups || []), ...(gate.groups || [])])];
79
- if (!same(groups, ["Doman Digital reviewers"]) || !empty(gate.allow) || !empty(gate.service_tokens)) fail("the registered gate must allow only the DD reviewer group");
92
+ if (!same(groups, ["Doman Digital reviewers"]) || !empty(gate.allow) || !empty(gate.service_tokens)) fail("the registered gate must allow only the DD reviewer group and its registered outside-domain addresses");
93
+ outsideAddresses(gate);
80
94
  const callbacks = gate.bypass || [];
81
95
  if (callbacks.some(b => !/^\/api\/(?:webhooks\/[a-z0-9-]+|revalidate)$/.test(b.path || "") || !b.why || !b.authProbe || b.authProbe.method !== "POST" || ![400, 401, 403].includes(b.authProbe.status))) fail("callback exceptions require exact API paths and an unsigned POST rejection probe");
82
96
  const reviewers = registry.groups?.[groups[0]];
@@ -96,10 +110,22 @@ function publicDestinations(app) {
96
110
  return [app.domain, ...(app.destinations || []).filter(d => d.type === "public").map(d => d.uri)].filter(Boolean);
97
111
  }
98
112
 
99
- function matchesHost(destination, hostname) {
113
+ export function matchesHost(destination, hostname) {
100
114
  const host = destination.split("/")[0].toLowerCase();
101
- const escaped = host.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
102
- return new RegExp(`^${escaped}$`).test(hostname);
115
+ // A `*` matches any run of characters. Done by hand, not with a RegExp built
116
+ // from the registry, so no pattern is ever compiled from data.
117
+ const parts = host.split("*");
118
+ if (parts.length === 1) return host === hostname;
119
+ const first = parts[0];
120
+ const last = parts[parts.length - 1];
121
+ if (!hostname.startsWith(first)) return false;
122
+ let at = first.length;
123
+ for (const part of parts.slice(1, -1)) {
124
+ const found = hostname.indexOf(part, at);
125
+ if (found < 0) return false;
126
+ at = found + part.length;
127
+ }
128
+ return hostname.length - last.length >= at && hostname.endsWith(last);
103
129
  }
104
130
 
105
131
  export function validateAccessState(protection, state, registry) {
@@ -123,7 +149,10 @@ export function validateAccessState(protection, state, registry) {
123
149
  if (app.name !== appName || app.type !== "self_hosted" || app.domain !== hostname || !same(app.destinations, [{ type: "public", uri: hostname }]) || app.session_duration !== "24h") fail("live Access app does not match the exact staging hostname and 24h session");
124
150
  if (!Array.isArray(app.policies) || app.policies.length !== 1) fail("exactly one reviewer allow policy is required");
125
151
  const policy = app.policies[0];
126
- if (policy.decision !== "allow" || !same(policy.include, [{ group: { id: reviewerGroupId } }]) || !empty(policy.exclude) || !empty(policy.require) || policy.session_duration !== "24h") fail("live policy must allow only the reviewer group for 24h; no bypass or service token");
152
+ const outside = outsideAddresses(registry.gates[protection.gateKey]);
153
+ const wanted = [JSON.stringify({ group: { id: reviewerGroupId } }), ...outside.map(email => JSON.stringify({ email: { email } }))].sort();
154
+ const have = Array.isArray(policy.include) ? policy.include.map(rule => JSON.stringify(rule)).sort() : null;
155
+ if (policy.decision !== "allow" || !same(have, wanted) || !empty(policy.exclude) || !empty(policy.require) || policy.session_duration !== "24h") fail("live policy must allow only the reviewer group and registered outside-domain addresses for 24h; no bypass or service token");
127
156
  const group = state.groups.find(g => g.id === reviewerGroupId);
128
157
  const expected = reviewers.map(email => ({ email: { email } }));
129
158
  if (!group || group.name !== "Doman Digital reviewers" || !empty(group.require) || !empty(group.exclude) || !Array.isArray(group.include) || !same([...group.include].sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b))), expected)) fail("the live reviewer group differs from the canonical named DD reviewers");
@@ -48,24 +48,38 @@ describe("the facts file is the single source of contact details", () => {
48
48
  });
49
49
  });
50
50
 
51
+ // .dd/site-start.json says how the site was started. A handover keeps the
52
+ // client's look and copy, so it only has to place the visible pieces it was
53
+ // started with (create-site --handover --with <piece>). A new build places all.
54
+ function startedWith(): { handover: boolean; pieces: string[] } {
55
+ try {
56
+ const label = JSON.parse(readFileSync(join(ROOT, ".dd", "site-start.json"), "utf8")) as { mode?: string; with?: unknown };
57
+ return { handover: label.mode === "handover", pieces: Array.isArray(label.with) ? label.with.filter((w): w is string => typeof w === "string") : [] };
58
+ } catch {
59
+ return { handover: false, pieces: [] };
60
+ }
61
+ }
62
+ const started = startedWith();
63
+ const places = (piece: string) => !started.handover || started.pieces.includes(piece);
64
+
51
65
  describe.runIf(mode === "launch")("ready to launch", () => {
52
- test("the designer credit is placed on the site", () => {
66
+ test.runIf(places("credit"))("the designer credit is placed on the site", () => {
53
67
  const placed = sourceFiles().some((file) => !/DesignerCredit\.(tsx|astro)$/.test(file) && readFileSync(file, "utf8").includes("<DesignerCredit"));
54
68
  expect(placed).toBe(true);
55
69
  });
56
70
 
57
- test("the cookie banner is placed on the site", () => {
71
+ test.runIf(places("consent"))("the cookie banner is placed on the site", () => {
58
72
  const placed = sourceFiles().some((file) => !/CookieBanner\.(tsx|astro)$/.test(file) && readFileSync(file, "utf8").includes("<CookieBanner"));
59
73
  expect(placed).toBe(true);
60
74
  });
61
75
 
62
- test("Cloudflare Web Analytics is placed on the site and has its token", () => {
76
+ test.runIf(places("analytics"))("Cloudflare Web Analytics is placed on the site and has its token", () => {
63
77
  const placed = sourceFiles().some((file) => !/WebAnalytics\.(tsx|astro)$/.test(file) && readFileSync(file, "utf8").includes("<WebAnalytics"));
64
78
  expect(placed).toBe(true);
65
79
  expect(facts.webAnalytics?.token ?? null).not.toBeNull();
66
80
  });
67
81
 
68
- test("the legal pages have what every site needs: retention, the processors, the governing law, a review date", () => {
82
+ test.runIf(places("legal"))("the legal pages have what every site needs: retention, the processors, the governing law, a review date", () => {
69
83
  const missing = [
70
84
  legal.retention ? null : "legal.retention",
71
85
  legal.processors.length > 0 ? null : "legal.processors (the host at least)",