@domandigital/create-site 0.3.2 → 0.5.0

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,27 @@
1
1
  # @domandigital/create-site
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1c08793: A new site now passes the DD Framework rulebook (`dd doctor`) on the day it is made. The CI workflow pins every action to a commit SHA, runs on the organisation's runner in a private repo (GitHub's in a public one, chosen with the new `--visibility`), and pnpm projects get `minimumReleaseAge` in `pnpm-workspace.yaml` so a release must be a day old before it installs (house packages exempt). Before this, every new site started with SEC-001, CI-001 and SEC-002 findings that become failures on 31 December 2026.
8
+
9
+ `--check` prints the plan, never prompts, and exits 3 when there is anything to do, a house file that differs from its template included, so CI and the nightly starter job can tell an up-to-date site from a drifted one.
10
+
11
+ The privacy, cookie, terms and accessibility pages and the cookie banner come over from dd-base (Doman-Digital/dd-library), rewritten to read `site.facts.ts` instead of `{{TOKEN}}` placeholders: a new optional `legal` block holds company number, ICO number, retention, processors, governing law and a review date, and a page leaves out what is null. `launch:check` now fails until the banner is placed and the legal facts every site needs are filled in. The banner stores the choice under the same key dd-base used, offers "Necessary only" and "Accept measurement" with equal weight, and `openCookieSettings()` brings it back.
12
+
13
+ New sites install `@domandigital/craft` `^0.18.0`, the release that adds `gradientContrast` and `checkPhotoReview`.
14
+
15
+ ## 0.4.0
16
+
17
+ ### Minor Changes
18
+
19
+ - c77c465: A new site now leaves behind `docs/client-facts.entry.json`: the technology the builder says it uses (host, DNS host, CMS, analytics and tags, error monitoring, email sending), shaped as an entry for Doman Digital's client register. It asks six new optional questions, or reads the same keys from `--answers`. Skipped answers are left out, not guessed; common names are mapped to the register's (`Google Analytics` becomes `ga4`); every tracking tool gets `consent: null` because the builder cannot know when it will run relative to the cookie banner. The entry is a data file, so `--force` never replaces it. The launch checklist gains a line asking for it to be handed over.
20
+
21
+ ### Patch Changes
22
+
23
+ - ef257c9: New sites install `@domandigital/craft` `^0.17.0`, to follow the craft release that adds `craft register`.
24
+
3
25
  ## 0.3.2
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -35,10 +35,14 @@ it is copied, which is the failure this exists to avoid.
35
35
  | `lib/graph/site-adapter.ts`, `lib/graph/page-graph.ts` | `site.facts.ts` mapped onto `@domandigital/graph`, and one JSON-LD graph per page. Only live profiles become `sameAs`; only checked accreditations reach search engines |
36
36
  | `components/JsonLd`, `components/DesignerCredit` | The JSON-LD script, and the credit: "Website by Doman Digital", linking to the homepage, `rel="nofollow"` |
37
37
  | `/press`, `/resources` | A press page built from the data files, and a noindex home for the site's linkable assets |
38
+ | `/privacy`, `/cookies`, `/terms`, `/accessibility` | The legal pages from dd-base (Doman-Digital/dd-library), reading the `legal` block of `site.facts.ts`. A null fact is left off the page, never shown as a placeholder |
39
+ | `components/CookieBanner`, `lib/consent.ts`, `lib/legal.ts` | The cookie banner (necessary only, or measurement as well, with equal weight), `getConsent()` for anything that sets a non-essential cookie, `openCookieSettings()` to change the choice, and the legal facts with defaults |
38
40
  | `tests/seo/*`, `tests/house.test.ts` | Route coverage, the redirect gate, JSON-LD integrity, the redirect wiring, and the rule that contact details live only in the facts file |
39
41
  | `docs/HOUSE.md` | The house rules, imported by `CLAUDE.md` (created if missing, otherwise one import line is added) |
40
42
  | `docs/DIRECTION.md`, `docs/seo-launch-checklist.md`, `docs/seo-baseline.md` | The site's decision and blocked registers, the listings to claim for its sector, and the launch, 90-day, 6-month and 12-month baseline |
41
- | `.github/workflows/seo-check.yml` | Only if the project has no workflows yet |
43
+ | `docs/client-facts.entry.json` | The technology the builder says the site uses, as an entry for Doman Digital's client register. Declared, not observed: every tracking tool has `consent: null` until someone fills it in from what the site does. Skipped answers are simply absent |
44
+ | `.github/workflows/seo-check.yml` | Only if the project has no workflows yet. Written to pass `dd doctor`: actions pinned to a commit SHA, the runner chosen by `--visibility`, a timeout and a concurrency group |
45
+ | `pnpm-workspace.yaml` | pnpm projects: `minimumReleaseAge: 1440` (house packages exempt), added to the file create-next-app writes, or a new one. A project's own value is kept |
42
46
  | `package.json` | `seo:check` and `launch:check` scripts, and the house packages |
43
47
 
44
48
  It then runs `craft direction init` through the installed craft bin to start
@@ -63,15 +67,32 @@ It then runs `craft direction init` through the installed craft bin to start
63
67
  create-site [dir] [--client <legal name>] [--trading-name <name>]
64
68
  [--site-url <https://...>] [--sector trades|beauty|clinics|professional]
65
69
  [--description "<one or two sentences>"] [--answers <file.json>]
66
- [--dry-run] [--force] [--skip-install] [--yes] [--help] [--version]
70
+ [--visibility private|public] [--dry-run] [--check] [--force]
71
+ [--skip-install] [--yes] [--help] [--version]
67
72
  ```
68
73
 
74
+ `--visibility` is the GitHub repo's (default `private`). A private repo's
75
+ workflow runs on `${{ vars.CI_RUNNER || 'ubuntu-latest' }}`; a public one on
76
+ `ubuntu-latest`, because a fork's pull request must never reach the
77
+ self-hosted runners.
78
+
79
+ `--check` is `--dry-run` for CI: it never prompts and exits 3 when there is
80
+ work to do, including a house file that differs from its template. Give it the
81
+ same answers the site was made with (`--answers`).
82
+
69
83
  `--answers` takes a JSON file with any of `legalName`, `tradingName`,
70
84
  `siteUrl`, `sector`, `description`, `phone`, `email`, `locality`,
71
85
  `postalCode`, `serviceAreas`, `registers` (ids from `src/sectors.ts`) and
72
- `previousHosts`.
86
+ `previousHosts`, and the declared technology: `host`, `dns`, `cms`,
87
+ `analytics` (a list, e.g. `["ga4", "gtm", "posthog"]`), `errorMonitoring` and
88
+ `emailSending` (a list). Each can be skipped, and a skipped one is left out of
89
+ `docs/client-facts.entry.json`, never filled with a guess. Common names are
90
+ mapped to the register's (`Google Analytics` becomes `ga4`); anything that
91
+ cannot be a register name (lowercase letters, digits, dots, hyphens) stops the
92
+ run with exit code 2 before anything is written.
73
93
 
74
- Exit codes: 0 done, 1 refused (nothing written), 2 usage error.
94
+ Exit codes: 0 done, 1 refused (nothing written), 2 usage error, 3 `--check`
95
+ found work to do.
75
96
 
76
97
  ## Supported projects
77
98
 
@@ -97,6 +118,15 @@ On 2026-09-24, 12 of the 42 entries were checked by rendering a listing in a
97
118
  browser. Most of the rest sit behind a CAPTCHA or a bot challenge, or have no
98
119
  single register. They need a person with a browser.
99
120
 
121
+ ## Passing the rulebook
122
+
123
+ A site made by `dd new` (Doman-Digital/dd-ci-standards) runs create-next-app,
124
+ then this, then `dd adopt`, and `dd doctor` is clean: nothing failing, nothing
125
+ warning, nothing exempt. The nightly starter job (`.github/workflows/starters.yml`
126
+ in dd-packages) makes a starter from scratch the same way every night, builds
127
+ it and runs `dd doctor` on it, so a rule the templates stop meeting is in Slack
128
+ the next morning.
129
+
100
130
  ## Upgrading a site
101
131
 
102
132
  Bump the house package ranges, then run `pnpm create @domandigital/site
package/dist/cli.js CHANGED
@@ -71,6 +71,63 @@ function registersFor(sector) {
71
71
  return REGISTERS.filter((r) => r.sectors === "all" || r.sectors.includes(sector));
72
72
  }
73
73
 
74
+ // src/stack.ts
75
+ var ALIASES = {
76
+ "google-analytics": "ga4",
77
+ "google-analytics-4": "ga4",
78
+ clarity: "microsoft-clarity",
79
+ "google-tag-manager": "gtm",
80
+ "facebook-pixel": "meta-pixel",
81
+ "fb-pixel": "meta-pixel"
82
+ };
83
+ var ANALYTICS_CATEGORY = { gtm: "tag-manager", "meta-pixel": "ads" };
84
+ var VALID_TOOL = /^[a-z0-9][a-z0-9.-]*$/;
85
+ function toolName(raw) {
86
+ const slug = raw.trim().toLowerCase().replace(/[\s_]+/g, "-").replace(/-+/g, "-");
87
+ const name = ALIASES[slug] ?? slug;
88
+ return VALID_TOOL.test(name) ? name : null;
89
+ }
90
+ function siteSlug(tradingName) {
91
+ return tradingName.toLowerCase().replace(/&/g, " and ").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
92
+ }
93
+ var declared = (category, tool) => ({ category, tool, evidence: ["Decl"] });
94
+ var tracking = (category, tool) => ({ category, tool, consent: null, evidence: ["Decl"] });
95
+ function buildStackEntry(a, framework, today) {
96
+ const s = a.stack;
97
+ const tools = [
98
+ // Detected from the project's own files, so this one is read from the repo, not declared.
99
+ { category: "framework", tool: framework === "next" ? "next-app-router" : "astro", evidence: ["C"] }
100
+ ];
101
+ if (s.host) tools.push(declared("host", s.host));
102
+ if (s.dns) tools.push(declared("dns", s.dns));
103
+ if (s.cms) tools.push(declared("cms", s.cms));
104
+ for (const name of s.analytics) {
105
+ const category = ANALYTICS_CATEGORY[name] ?? "analytics";
106
+ tools.push(tracking(category, name));
107
+ }
108
+ if (s.errorMonitoring) tools.push(declared("error-monitoring", s.errorMonitoring));
109
+ for (const name of s.emailSending) tools.push(declared("email-sending", name));
110
+ const gaps = ["Declared at scaffold by the builder. Nothing here has been observed on a live site yet."];
111
+ if (!s.host) gaps.push("Host not declared.");
112
+ if (!s.dns) gaps.push("DNS host not declared.");
113
+ return {
114
+ [siteSlug(a.tradingName)]: {
115
+ siteUrl: a.siteUrl,
116
+ facts: {},
117
+ stack: {
118
+ verifiedOn: today,
119
+ method: "create-site scaffold: declared by the builder, not observed",
120
+ tools,
121
+ gaps
122
+ }
123
+ }
124
+ };
125
+ }
126
+ function renderStackEntry(a, framework, today) {
127
+ return `${JSON.stringify(buildStackEntry(a, framework, today), null, 2)}
128
+ `;
129
+ }
130
+
74
131
  // src/answers.ts
75
132
  var REQUIRED = [
76
133
  ["legalName", "--client", "Registered business name"],
@@ -90,6 +147,30 @@ function validateSiteUrl(value) {
90
147
  return `not a URL: ${value}`;
91
148
  }
92
149
  }
150
+ async function collectStack(optional) {
151
+ const problems = [];
152
+ const name = (key, value) => {
153
+ const n = toolName(value);
154
+ if (!n) problems.push(`${key}: "${value}" is not a usable name (lowercase letters, digits, dots and hyphens)`);
155
+ return n ?? value;
156
+ };
157
+ const single = async (key, question) => {
158
+ const v = text(await optional(key, question));
159
+ return v === null ? null : name(key, v);
160
+ };
161
+ const many = async (key, question) => [
162
+ ...new Set(list(await optional(key, question)).map((v) => name(key, v)))
163
+ ];
164
+ const stack = {
165
+ host: await single("host", "Hosting, e.g. vercel"),
166
+ dns: await single("dns", "DNS host, e.g. cloudflare"),
167
+ cms: await single("cms", "CMS, e.g. sanity"),
168
+ analytics: await many("analytics", "Analytics and tags, comma separated, e.g. ga4, gtm, posthog"),
169
+ errorMonitoring: await single("errorMonitoring", "Error monitoring, e.g. sentry"),
170
+ emailSending: await many("emailSending", "Email sending services, comma separated, e.g. resend")
171
+ };
172
+ return problems.length > 0 ? problems.join("; ") : stack;
173
+ }
93
174
  async function collectAnswers(sources) {
94
175
  let file = {};
95
176
  if (sources.file) {
@@ -131,6 +212,8 @@ async function collectAnswers(sources) {
131
212
  const unknownRegisters = registers.filter((id) => !known.some((r) => r.id === id));
132
213
  if (unknownRegisters.length > 0) return `unknown register id for ${sector}: ${unknownRegisters.join(", ")}`;
133
214
  const previousHosts = list(await optional("previousHosts", "Previous website hostname, if moving from one"));
215
+ const stack = await collectStack(optional);
216
+ if (typeof stack === "string") return stack;
134
217
  return {
135
218
  legalName: values.legalName,
136
219
  tradingName,
@@ -143,7 +226,8 @@ async function collectAnswers(sources) {
143
226
  postalCode,
144
227
  serviceAreas,
145
228
  registers,
146
- previousHosts
229
+ previousHosts,
230
+ stack
147
231
  };
148
232
  }
149
233
 
@@ -164,6 +248,7 @@ function applyPlan(plan, clientName, exec) {
164
248
  }
165
249
  if (plan.packageJson) writeInside(root, "package.json", plan.packageJson.text);
166
250
  if (plan.config) writeInside(root, plan.config.file, plan.config.text);
251
+ if (plan.pnpmWorkspace) writeInside(root, "pnpm-workspace.yaml", plan.pnpmWorkspace.text);
167
252
  if (plan.claudeMd) writeInside(root, "CLAUDE.md", plan.claudeMd.text);
168
253
  for (const c of plan.commands) exec(c.cmd, c.args, root);
169
254
  if (plan.craftInit) {
@@ -191,15 +276,21 @@ Usage
191
276
  create-site [dir] [--client <legal name>] [--trading-name <name>]
192
277
  [--site-url <https://...>] [--sector trades|beauty|clinics|professional]
193
278
  [--description "<one or two sentences>"] [--answers <file.json>]
194
- [--dry-run] [--force] [--skip-install] [--yes] [--help] [--version]
279
+ [--visibility private|public] [--dry-run] [--check] [--force]
280
+ [--skip-install] [--yes] [--help] [--version]
195
281
 
196
282
  --dry-run Print the plan and stop. Writes nothing, runs nothing.
283
+ --check Like --dry-run, never prompts, and exits 3 when there is work to do,
284
+ a house file that differs from its template included. For CI.
285
+ --visibility The GitHub repo's visibility (default private). Decides the runner
286
+ the CI workflow names, so it passes dd doctor either way.
197
287
  --force Replace house template files that differ. Data files (the facts,
198
288
  routes, links, redirects, DIRECTION and baseline) are never replaced.
199
289
  --skip-install Write the package ranges into package.json instead of installing.
200
290
  --yes Never prompt. Missing required answers are an error, not a guess.
201
291
 
202
- Exit codes: 0 done, 1 refused (nothing written), 2 usage error.`;
292
+ Exit codes: 0 done, 1 refused (nothing written), 2 usage error,
293
+ 3 --check found work to do.`;
203
294
  function parseOptions(argv) {
204
295
  try {
205
296
  const { values, positionals } = parseArgs({
@@ -214,6 +305,8 @@ function parseOptions(argv) {
214
305
  description: { type: "string" },
215
306
  answers: { type: "string" },
216
307
  "dry-run": { type: "boolean", default: false },
308
+ check: { type: "boolean", default: false },
309
+ visibility: { type: "string", default: "private" },
217
310
  force: { type: "boolean", default: false },
218
311
  "skip-install": { type: "boolean", default: false },
219
312
  yes: { type: "boolean", short: "y", default: false },
@@ -222,6 +315,7 @@ function parseOptions(argv) {
222
315
  }
223
316
  });
224
317
  if (positionals.length > 1) return `one directory at most, got ${positionals.length}`;
318
+ if (values.visibility !== "private" && values.visibility !== "public") return `--visibility is private or public, not ${values.visibility}`;
225
319
  return {
226
320
  dir: positionals[0],
227
321
  client: values.client,
@@ -231,6 +325,8 @@ function parseOptions(argv) {
231
325
  description: values.description,
232
326
  answers: values.answers,
233
327
  dryRun: values["dry-run"] ?? false,
328
+ check: values.check ?? false,
329
+ visibility: values.visibility,
234
330
  force: values.force ?? false,
235
331
  skipInstall: values["skip-install"] ?? false,
236
332
  yes: values.yes ?? false,
@@ -331,7 +427,9 @@ function layoutFor(project) {
331
427
  { template: "shared/tests/seo/coverage.test.ts", dest: "tests/seo/coverage.test.ts" },
332
428
  { template: "shared/tests/seo/redirects.test.ts", dest: "tests/seo/redirects.test.ts" },
333
429
  { template: "shared/tests/seo/graph.test.ts", dest: "tests/seo/graph.test.ts" },
334
- { template: "shared/tests/house.test.ts", dest: "tests/house.test.ts" }
430
+ { template: "shared/tests/house.test.ts", dest: "tests/house.test.ts" },
431
+ { template: "shared/lib/consent.ts", dest: `${base}lib/consent.ts` },
432
+ { template: "shared/lib/legal.ts", dest: `${base}lib/legal.ts` }
335
433
  ];
336
434
  const siteKeys = {
337
435
  facts: "site.facts.ts",
@@ -340,11 +438,18 @@ function layoutFor(project) {
340
438
  "redirects.json": "redirects.json",
341
439
  "site-adapter": `${base}lib/graph/site-adapter.ts`,
342
440
  "page-graph": `${base}lib/graph/page-graph.ts`,
343
- "routes-on-disk": "tests/seo/routes-on-disk.ts"
441
+ "routes-on-disk": "tests/seo/routes-on-disk.ts",
442
+ consent: `${base}lib/consent.ts`,
443
+ legal: `${base}lib/legal.ts`
344
444
  };
345
445
  if (project.configFile) siteKeys["framework-config"] = project.configFile;
346
446
  if (project.framework === "next") {
347
447
  siteKeys["components/JsonLd"] = `${base}components/JsonLd.tsx`;
448
+ siteKeys["components/CookieBanner"] = `${base}components/CookieBanner.tsx`;
449
+ const legalPages = ["privacy", "cookies", "terms", "accessibility"].map((page) => ({
450
+ template: `next/app/${page}/page.tsx`,
451
+ dest: `${project.routesDir}/${page}/page.tsx`
452
+ }));
348
453
  return {
349
454
  siteKeys,
350
455
  templates: [
@@ -354,7 +459,9 @@ function layoutFor(project) {
354
459
  { template: "next/components/JsonLd.tsx", dest: `${base}components/JsonLd.tsx` },
355
460
  { template: "next/components/DesignerCredit.tsx", dest: `${base}components/DesignerCredit.tsx` },
356
461
  { template: "next/app/press/page.tsx", dest: `${project.routesDir}/press/page.tsx` },
357
- { template: "next/app/resources/page.tsx", dest: `${project.routesDir}/resources/page.tsx` }
462
+ { template: "next/app/resources/page.tsx", dest: `${project.routesDir}/resources/page.tsx` },
463
+ { template: "next/components/CookieBanner.tsx", dest: `${base}components/CookieBanner.tsx` },
464
+ ...legalPages
358
465
  ]
359
466
  };
360
467
  }
@@ -368,7 +475,9 @@ function layoutFor(project) {
368
475
  { template: "astro/components/JsonLd.astro", dest: "src/components/JsonLd.astro" },
369
476
  { template: "astro/components/DesignerCredit.astro", dest: "src/components/DesignerCredit.astro" },
370
477
  { template: "astro/pages/press.astro", dest: "src/pages/press.astro" },
371
- { template: "astro/pages/resources/index.astro", dest: "src/pages/resources/index.astro" }
478
+ { template: "astro/pages/resources/index.astro", dest: "src/pages/resources/index.astro" },
479
+ { template: "astro/components/CookieBanner.astro", dest: "src/components/CookieBanner.astro" },
480
+ ...["privacy", "cookies", "terms", "accessibility"].map((page) => ({ template: `astro/pages/${page}.astro`, dest: `src/pages/${page}.astro` }))
372
481
  ]
373
482
  };
374
483
  }
@@ -481,6 +590,7 @@ function policyPatternsFor(bracketPath) {
481
590
  }
482
591
 
483
592
  // src/render/data.ts
593
+ var LEGAL_ROUTES = ["/accessibility", "/cookies", "/privacy", "/terms"];
484
594
  var q = (value) => value === null ? "null" : JSON.stringify(value);
485
595
  var arr = (values) => `[${values.map((v) => JSON.stringify(v)).join(", ")}]`;
486
596
  function renderFacts(a, siteAdapterSpec) {
@@ -518,12 +628,30 @@ export const facts: SiteFacts = {
518
628
  // { kind, name, url, status }. Only "live" profiles become sameAs.
519
629
  profiles: [],
520
630
  previousHosts: ${arr(a.previousHosts)},
631
+ // The privacy, cookie, terms and accessibility pages read these. A null is
632
+ // left off the page; launch:check fails until retention, the processors
633
+ // (the host at least), the governing law and reviewedOn are set.
634
+ legal: {
635
+ companyNumber: null,
636
+ registeredOffice: null,
637
+ icoNumber: null,
638
+ privacyEmail: null,
639
+ retention: null,
640
+ // { name, purpose, setsCookies }
641
+ processors: [],
642
+ governingLaw: null,
643
+ accessibilityIssues: [],
644
+ reviewedOn: null,
645
+ },
521
646
  };
522
647
  `;
523
648
  }
524
649
  function renderRoutes(routesOnDisk3, dynamicRoutesOnDisk3 = []) {
525
- const routes = [.../* @__PURE__ */ new Set([...routesOnDisk3, "/press"])].filter((r) => r !== "/resources").sort();
650
+ const routes = [.../* @__PURE__ */ new Set([...routesOnDisk3, "/press"])].filter((r) => r !== "/resources" && !LEGAL_ROUTES.includes(r)).sort();
526
651
  const entries = routes.map((path) => ` { path: ${JSON.stringify(path)}, indexable: true, inSitemap: true },`);
652
+ for (const path of LEGAL_ROUTES) {
653
+ entries.push(` { path: ${JSON.stringify(path)}, indexable: true, inSitemap: false, reason: "Legal page: linked from every page's footer, not a search landing page." },`);
654
+ }
527
655
  const patterns = /* @__PURE__ */ new Map();
528
656
  for (const route of dynamicRoutesOnDisk3) {
529
657
  for (const pattern of policyPatternsFor(route)) if (pattern.endsWith("/*") && !patterns.has(pattern)) patterns.set(pattern, route);
@@ -563,6 +691,10 @@ export const trailLabels: TrailLabel[] = [
563
691
  { path: "/", label: "Home" },
564
692
  { path: "/press", label: "Press" },
565
693
  { path: "/resources", label: "Resources" },
694
+ { path: "/privacy", label: "Privacy policy" },
695
+ { path: "/cookies", label: "Cookie policy" },
696
+ { path: "/terms", label: "Website terms" },
697
+ { path: "/accessibility", label: "Accessibility" },
566
698
  ];
567
699
 
568
700
  /**
@@ -593,6 +725,22 @@ function renderRedirects() {
593
725
  `;
594
726
  }
595
727
 
728
+ // src/versions.ts
729
+ var HOUSE_DEPENDENCIES = {
730
+ "@domandigital/graph": "^0.7.0",
731
+ "@domandigital/seo": "^0.3.0"
732
+ };
733
+ var HOUSE_DEV_DEPENDENCIES = {
734
+ "@domandigital/craft": "^0.18.0",
735
+ "@types/node": "^22.0.0",
736
+ vitest: "^4.1.11"
737
+ };
738
+ var ACTIONS = {
739
+ checkout: "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1",
740
+ setupNode: "actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0",
741
+ setupPnpm: "pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0"
742
+ };
743
+
596
744
  // src/render/docs.ts
597
745
  var run = (pm, script) => pm === "npm" ? `npm run ${script}` : `${pm} ${script}`;
598
746
  function renderHouseMd(a, project) {
@@ -695,6 +843,7 @@ ${rest.map(line).join("\n")}
695
843
 
696
844
  - [ ] Every URL of any previous site that other sites link to has a redirect in \`redirects.json\`, and \`seo:check\` passes. On Astro with static output, redirects are meta-refresh pages: use a host adapter or host-level redirects for a migration.
697
845
  - [ ] \`launch:check\` passes.
846
+ - [ ] The site is in Doman Digital's client register: \`docs/client-facts.entry.json\` handed over with every null filled in.
698
847
  - [ ] Search Console property verified and the sitemap submitted.
699
848
  - [ ] The launch column of \`docs/seo-baseline.md\` filled in.
700
849
  `;
@@ -721,16 +870,17 @@ Started ${today}.
721
870
  ${rows.map(([measure, source]) => `| ${measure} | | | | | ${source} |`).join("\n")}
722
871
  `;
723
872
  }
724
- function renderWorkflow(project) {
873
+ function renderWorkflow(project, visibility = "private") {
725
874
  const pm = project.packageManager;
726
875
  if (pm !== "pnpm" && pm !== "npm") return null;
727
- const setup = pm === "pnpm" ? ` - uses: pnpm/action-setup@v4
728
- - uses: actions/setup-node@v5
876
+ const runsOn = visibility === "public" ? "ubuntu-latest" : "${{ vars.CI_RUNNER || 'ubuntu-latest' }}";
877
+ const setup = pm === "pnpm" ? ` - uses: ${ACTIONS.setupPnpm}
878
+ - uses: ${ACTIONS.setupNode}
729
879
  with:
730
880
  node-version: '22.x'
731
881
  cache: 'pnpm'
732
882
  - run: pnpm install --frozen-lockfile
733
- - run: pnpm seo:check` : ` - uses: actions/setup-node@v5
883
+ - run: pnpm seo:check` : ` - uses: ${ACTIONS.setupNode}
734
884
  with:
735
885
  node-version: '22.x'
736
886
  cache: 'npm'
@@ -739,7 +889,10 @@ function renderWorkflow(project) {
739
889
  return `name: seo-check
740
890
 
741
891
  # The house SEO checks on every pull request: route coverage, redirects,
742
- # JSON-LD and the facts-file rule. Written by @domandigital/create-site.
892
+ # JSON-LD and the facts-file rule. Written by @domandigital/create-site to pass
893
+ # the Doman Digital rulebook (dd doctor): actions pinned to a commit SHA,
894
+ # ${visibility === "public" ? "GitHub's runners (a public repo never uses the self-hosted ones)" : "the organisation's runner where CI_RUNNER is set, GitHub's otherwise"},
895
+ # a timeout, and a concurrency group.
743
896
 
744
897
  on:
745
898
  pull_request:
@@ -753,10 +906,12 @@ concurrency:
753
906
 
754
907
  jobs:
755
908
  seo:
756
- runs-on: ubuntu-latest
909
+ runs-on: ${runsOn}
757
910
  timeout-minutes: 10
758
911
  steps:
759
- - uses: actions/checkout@v5
912
+ - uses: ${ACTIONS.checkout}
913
+ with:
914
+ persist-credentials: false
760
915
  ${setup}
761
916
  `;
762
917
  }
@@ -775,6 +930,24 @@ function websiteStatus(r) {
775
930
  }
776
931
  }
777
932
 
933
+ // src/pnpm-workspace.ts
934
+ var MINIMUM_RELEASE_AGE_MINUTES = 1440;
935
+ var BLOCK = `# Added by @domandigital/create-site (dd doctor SEC-002): a release must be a
936
+ # day old before pnpm installs it. The house packages are exempt.
937
+ minimumReleaseAge: ${MINIMUM_RELEASE_AGE_MINUTES}
938
+ minimumReleaseAgeExclude:
939
+ - "@domandigital/*"
940
+ `;
941
+ function patchPnpmWorkspace(text2) {
942
+ if (text2 === null) return BLOCK;
943
+ if (/^minimumReleaseAge\s*:/m.test(text2)) return null;
944
+ const block = /^minimumReleaseAgeExclude\s*:/m.test(text2) ? BLOCK.replace(/minimumReleaseAgeExclude:\n.*\n/, "") : BLOCK;
945
+ const body = text2.trimEnd();
946
+ return body ? `${body}
947
+
948
+ ${block}` : block;
949
+ }
950
+
778
951
  // src/templates.ts
779
952
  import { readFileSync as readFileSync4 } from "fs";
780
953
  import { dirname as dirname2, posix, relative } from "path";
@@ -795,17 +968,6 @@ function rewriteSiteImports(text2, dest, siteKeys) {
795
968
  });
796
969
  }
797
970
 
798
- // src/versions.ts
799
- var HOUSE_DEPENDENCIES = {
800
- "@domandigital/graph": "^0.7.0",
801
- "@domandigital/seo": "^0.3.0"
802
- };
803
- var HOUSE_DEV_DEPENDENCIES = {
804
- "@domandigital/craft": "^0.16.0",
805
- "@types/node": "^22.0.0",
806
- vitest: "^4.1.11"
807
- };
808
-
809
971
  // templates/next/tests/seo/routes-on-disk.ts
810
972
  var routes_on_disk_exports = {};
811
973
  __export(routes_on_disk_exports, {
@@ -917,6 +1079,9 @@ function planScaffold(project, answers, options) {
917
1079
  const layout = layoutFor(project);
918
1080
  const notes = [];
919
1081
  if (project.packageManagerWarning) notes.push(project.packageManagerWarning);
1082
+ notes.push(
1083
+ "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)."
1084
+ );
920
1085
  const files = [];
921
1086
  for (const t of layout.templates) {
922
1087
  if (t.template.endsWith("config.test.ts") && !project.configFile) {
@@ -935,10 +1100,11 @@ function planScaffold(project, answers, options) {
935
1100
  { path: "docs/HOUSE.md", contents: renderHouseMd(answers, project), data: false },
936
1101
  { path: "docs/DIRECTION.md", contents: renderDirection(answers, options.today), data: true },
937
1102
  { path: "docs/seo-launch-checklist.md", contents: renderChecklist(answers), data: true },
938
- { path: "docs/seo-baseline.md", contents: renderBaseline(answers, options.today), data: true }
1103
+ { path: "docs/seo-baseline.md", contents: renderBaseline(answers, options.today), data: true },
1104
+ { path: "docs/client-facts.entry.json", contents: renderStackEntry(answers, project.framework, options.today), data: true }
939
1105
  );
940
1106
  const workflowPath = ".github/workflows/seo-check.yml";
941
- const workflow = renderWorkflow(project);
1107
+ const workflow = renderWorkflow(project, options.visibility ?? "private");
942
1108
  if (existsSync5(join5(root, workflowPath)) || workflow && !hasWorkflows(root)) {
943
1109
  if (workflow) files.push({ path: workflowPath, contents: workflow, data: false });
944
1110
  } else if (!workflow) {
@@ -975,6 +1141,13 @@ function planScaffold(project, answers, options) {
975
1141
  if (patched.kind === "patched") config = { file: project.configFile, text: patched.text };
976
1142
  if (patched.kind === "manual") notes.push(`${patched.reason}: ${MANUAL_INSTRUCTIONS[project.framework]}. tests/seo/config.test.ts fails until it does.`);
977
1143
  }
1144
+ let pnpmWorkspace = null;
1145
+ if (project.packageManager === "pnpm") {
1146
+ const path = join5(root, "pnpm-workspace.yaml");
1147
+ const current = existsSync5(path) ? readFileSync5(path, "utf8") : null;
1148
+ const text2 = patchPnpmWorkspace(current);
1149
+ if (text2 !== null) pnpmWorkspace = { text: text2, created: current === null };
1150
+ }
978
1151
  const claudePath = join5(root, "CLAUDE.md");
979
1152
  const claudeText = existsSync5(claudePath) ? readFileSync5(claudePath, "utf8") : null;
980
1153
  const claudeMd = claudeText === null ? { text: `${HOUSE_IMPORT}
@@ -990,6 +1163,7 @@ ${HOUSE_IMPORT}
990
1163
  files: planned,
991
1164
  packageJson: pkg.changes.length ? pkg : null,
992
1165
  config,
1166
+ pnpmWorkspace,
993
1167
  claudeMd,
994
1168
  commands,
995
1169
  craftInit,
@@ -997,7 +1171,17 @@ ${HOUSE_IMPORT}
997
1171
  };
998
1172
  }
999
1173
  function hasWork(plan) {
1000
- return plan.files.some((f) => f.action === "create" || f.action === "overwrite") || plan.packageJson !== null || plan.config !== null || plan.claudeMd !== null || plan.commands.length > 0 || plan.craftInit;
1174
+ return plan.files.some((f) => f.action === "create" || f.action === "overwrite") || plan.packageJson !== null || plan.config !== null || plan.pnpmWorkspace !== null || plan.claudeMd !== null || plan.commands.length > 0 || plan.craftInit;
1175
+ }
1176
+ function pendingWork(plan) {
1177
+ const out = plan.files.filter((f) => f.action === "create" || f.action === "overwrite" || f.action === "skip-exists").map((f) => `${f.action === "skip-exists" ? "differs from the house template" : "missing"}: ${f.path}`);
1178
+ if (plan.packageJson) out.push(`package.json: ${plan.packageJson.changes.join(", ")}`);
1179
+ if (plan.config) out.push(`${plan.config.file}: does not serve redirects.json`);
1180
+ if (plan.pnpmWorkspace) out.push("pnpm-workspace.yaml: no minimumReleaseAge");
1181
+ if (plan.claudeMd) out.push("CLAUDE.md: does not import docs/HOUSE.md");
1182
+ for (const c of plan.commands) out.push(`not installed: ${c.args.filter((a) => a.includes("@", 1)).join(" ")}`);
1183
+ if (plan.craftInit) out.push("no art-direction.json");
1184
+ return out;
1001
1185
  }
1002
1186
  var LABEL = {
1003
1187
  create: "create ",
@@ -1017,6 +1201,7 @@ function formatPlan(plan, clientName) {
1017
1201
  for (const f of plan.files) lines.push(` ${LABEL[f.action]} ${f.path}${SUFFIX[f.action] ?? ""}`);
1018
1202
  if (plan.packageJson) lines.push(` patch package.json: ${plan.packageJson.changes.join(", ")}`);
1019
1203
  if (plan.config) lines.push(` patch ${plan.config.file}: serve redirects.json`);
1204
+ if (plan.pnpmWorkspace) lines.push(` ${plan.pnpmWorkspace.created ? "create " : "patch "} pnpm-workspace.yaml: minimumReleaseAge (install protection)`);
1020
1205
  if (plan.claudeMd) lines.push(` ${plan.claudeMd.created ? "create " : "patch "} CLAUDE.md: import docs/HOUSE.md`);
1021
1206
  for (const c of plan.commands) lines.push(` run ${c.cmd} ${c.args.join(" ")}`);
1022
1207
  if (plan.craftInit) lines.push(` run craft direction init --client ${JSON.stringify(clientName)}`);
@@ -1058,15 +1243,25 @@ ${USAGE}`);
1058
1243
  },
1059
1244
  file: options.answers,
1060
1245
  cwd: io.cwd,
1061
- ask: options.yes ? void 0 : io.ask
1246
+ ask: options.yes || options.check ? void 0 : io.ask
1062
1247
  });
1063
1248
  if (typeof answers === "string") {
1064
1249
  io.err(`create-site: ${answers}`);
1065
1250
  return 2;
1066
1251
  }
1067
1252
  const today = io.now().toISOString().slice(0, 10);
1068
- const plan = planScaffold(project, answers, { force: options.force, skipInstall: options.skipInstall, today });
1253
+ const plan = planScaffold(project, answers, { force: options.force, skipInstall: options.skipInstall, today, visibility: options.visibility });
1069
1254
  io.out(formatPlan(plan, answers.tradingName));
1255
+ if (options.check) {
1256
+ const work = pendingWork(plan);
1257
+ if (work.length === 0) {
1258
+ io.out("create-site --check: up to date.");
1259
+ return 0;
1260
+ }
1261
+ io.err(`create-site --check: ${work.length} thing(s) to do.
1262
+ ${work.map((w) => ` ${w}`).join("\n")}`);
1263
+ return 3;
1264
+ }
1070
1265
  if (options.dryRun || !hasWork(plan)) return 0;
1071
1266
  const pending = applyPlan(plan, answers.tradingName, io.exec);
1072
1267
  const pm = project.packageManager === "npm" ? "npm run" : project.packageManager;
@@ -1075,7 +1270,9 @@ ${USAGE}`);
1075
1270
  "",
1076
1271
  "Next:",
1077
1272
  " 1. Fill in site.facts.ts: contact details, hours, accreditations, profiles. Unknown stays null.",
1078
- " 2. Put <DesignerCredit /> in the footer, and <JsonLd graph={buildPageGraph(...)} /> on every page.",
1273
+ " 2. Put <DesignerCredit /> and links to /privacy, /cookies, /terms and /accessibility in the footer,",
1274
+ " <CookieBanner /> once in the root layout, and <JsonLd graph={buildPageGraph(...)} /> on every page.",
1275
+ " Fill in legal in site.facts.ts and have the client confirm the legal pages match what the business does.",
1079
1276
  " 3. Work through docs/seo-launch-checklist.md.",
1080
1277
  ` 4. ${pm} seo:check now, and ${pm} launch:check before go-live.`,
1081
1278
  ...pending.map((p) => ` Still to run: ${p}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domandigital/create-site",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
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",
@@ -41,7 +41,7 @@
41
41
  "tsup": "^8.3.5",
42
42
  "typescript": "^5.6.3",
43
43
  "vitest": "^2.1.9",
44
- "@domandigital/craft": "^0.16.0",
44
+ "@domandigital/craft": "^0.18.0",
45
45
  "@domandigital/graph": "^0.7.0",
46
46
  "@domandigital/seo": "^0.3.1"
47
47
  },
@@ -0,0 +1,42 @@
1
+ ---
2
+ // The cookie banner. Written by @domandigital/create-site, from the dd-base
3
+ // banner (Doman-Digital/dd-library). Unstyled: style it with the site's own
4
+ // classes. Put <CookieBanner /> once in the base layout; launch:check fails
5
+ // until it is placed.
6
+ //
7
+ // Hidden until the script finds no stored choice, so a returning visitor
8
+ // never sees it flash. The two buttons carry equal weight: refusing must be
9
+ // as easy as accepting. Any element with data-cookie-settings brings it back.
10
+ interface Props {
11
+ class?: string;
12
+ }
13
+
14
+ const { class: className } = Astro.props;
15
+ ---
16
+
17
+ <div class={className} role="region" aria-label="Cookie choices" data-cookie-banner hidden>
18
+ <p>
19
+ We use cookies the site needs to work. With your permission we also use measurement cookies to see how the site is
20
+ used. <a href="/cookies">Cookie policy</a>
21
+ </p>
22
+ <button type="button" data-cookie-choice="necessary">Necessary only</button>
23
+ <button type="button" data-cookie-choice="measurement">Accept measurement</button>
24
+ </div>
25
+
26
+ <script>
27
+ import { SETTINGS_EVENT, getConsent, setConsent } from "~site/consent";
28
+
29
+ const banner = document.querySelector<HTMLElement>("[data-cookie-banner]");
30
+ if (banner) {
31
+ banner.hidden = getConsent() !== null;
32
+ banner.querySelectorAll<HTMLButtonElement>("[data-cookie-choice]").forEach((button) => {
33
+ button.addEventListener("click", () => {
34
+ setConsent(button.dataset.cookieChoice === "measurement");
35
+ banner.hidden = true;
36
+ });
37
+ });
38
+ window.addEventListener(SETTINGS_EVENT, () => {
39
+ banner.hidden = false;
40
+ });
41
+ }
42
+ </script>