@domandigital/create-site 0.4.0 → 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 +12 -0
- package/README.md +26 -3
- package/dist/cli.js +138 -30
- package/package.json +2 -2
- package/templates/astro/components/CookieBanner.astro +42 -0
- package/templates/astro/pages/accessibility.astro +65 -0
- package/templates/astro/pages/cookies.astro +72 -0
- package/templates/astro/pages/privacy.astro +90 -0
- package/templates/astro/pages/terms.astro +76 -0
- package/templates/next/app/accessibility/page.tsx +65 -0
- package/templates/next/app/cookies/page.tsx +74 -0
- package/templates/next/app/privacy/page.tsx +96 -0
- package/templates/next/app/terms/page.tsx +79 -0
- package/templates/next/components/CookieBanner.tsx +55 -0
- package/templates/shared/lib/consent.ts +45 -0
- package/templates/shared/lib/graph/site-adapter.ts +36 -0
- package/templates/shared/lib/legal.ts +33 -0
- package/templates/shared/tests/house.test.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 0.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -35,11 +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
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 |
|
|
42
|
-
| `.github/workflows/seo-check.yml` | Only if the project has no workflows yet |
|
|
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 |
|
|
43
46
|
| `package.json` | `seo:check` and `launch:check` scripts, and the house packages |
|
|
44
47
|
|
|
45
48
|
It then runs `craft direction init` through the installed craft bin to start
|
|
@@ -64,9 +67,19 @@ It then runs `craft direction init` through the installed craft bin to start
|
|
|
64
67
|
create-site [dir] [--client <legal name>] [--trading-name <name>]
|
|
65
68
|
[--site-url <https://...>] [--sector trades|beauty|clinics|professional]
|
|
66
69
|
[--description "<one or two sentences>"] [--answers <file.json>]
|
|
67
|
-
[--
|
|
70
|
+
[--visibility private|public] [--dry-run] [--check] [--force]
|
|
71
|
+
[--skip-install] [--yes] [--help] [--version]
|
|
68
72
|
```
|
|
69
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
|
+
|
|
70
83
|
`--answers` takes a JSON file with any of `legalName`, `tradingName`,
|
|
71
84
|
`siteUrl`, `sector`, `description`, `phone`, `email`, `locality`,
|
|
72
85
|
`postalCode`, `serviceAreas`, `registers` (ids from `src/sectors.ts`) and
|
|
@@ -78,7 +91,8 @@ mapped to the register's (`Google Analytics` becomes `ga4`); anything that
|
|
|
78
91
|
cannot be a register name (lowercase letters, digits, dots, hyphens) stops the
|
|
79
92
|
run with exit code 2 before anything is written.
|
|
80
93
|
|
|
81
|
-
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.
|
|
82
96
|
|
|
83
97
|
## Supported projects
|
|
84
98
|
|
|
@@ -104,6 +118,15 @@ On 2026-09-24, 12 of the 42 entries were checked by rendering a listing in a
|
|
|
104
118
|
browser. Most of the rest sit behind a CAPTCHA or a bot challenge, or have no
|
|
105
119
|
single register. They need a person with a browser.
|
|
106
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
|
+
|
|
107
130
|
## Upgrading a site
|
|
108
131
|
|
|
109
132
|
Bump the house package ranges, then run `pnpm create @domandigital/site
|
package/dist/cli.js
CHANGED
|
@@ -248,6 +248,7 @@ function applyPlan(plan, clientName, exec) {
|
|
|
248
248
|
}
|
|
249
249
|
if (plan.packageJson) writeInside(root, "package.json", plan.packageJson.text);
|
|
250
250
|
if (plan.config) writeInside(root, plan.config.file, plan.config.text);
|
|
251
|
+
if (plan.pnpmWorkspace) writeInside(root, "pnpm-workspace.yaml", plan.pnpmWorkspace.text);
|
|
251
252
|
if (plan.claudeMd) writeInside(root, "CLAUDE.md", plan.claudeMd.text);
|
|
252
253
|
for (const c of plan.commands) exec(c.cmd, c.args, root);
|
|
253
254
|
if (plan.craftInit) {
|
|
@@ -275,15 +276,21 @@ Usage
|
|
|
275
276
|
create-site [dir] [--client <legal name>] [--trading-name <name>]
|
|
276
277
|
[--site-url <https://...>] [--sector trades|beauty|clinics|professional]
|
|
277
278
|
[--description "<one or two sentences>"] [--answers <file.json>]
|
|
278
|
-
[--
|
|
279
|
+
[--visibility private|public] [--dry-run] [--check] [--force]
|
|
280
|
+
[--skip-install] [--yes] [--help] [--version]
|
|
279
281
|
|
|
280
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.
|
|
281
287
|
--force Replace house template files that differ. Data files (the facts,
|
|
282
288
|
routes, links, redirects, DIRECTION and baseline) are never replaced.
|
|
283
289
|
--skip-install Write the package ranges into package.json instead of installing.
|
|
284
290
|
--yes Never prompt. Missing required answers are an error, not a guess.
|
|
285
291
|
|
|
286
|
-
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.`;
|
|
287
294
|
function parseOptions(argv) {
|
|
288
295
|
try {
|
|
289
296
|
const { values, positionals } = parseArgs({
|
|
@@ -298,6 +305,8 @@ function parseOptions(argv) {
|
|
|
298
305
|
description: { type: "string" },
|
|
299
306
|
answers: { type: "string" },
|
|
300
307
|
"dry-run": { type: "boolean", default: false },
|
|
308
|
+
check: { type: "boolean", default: false },
|
|
309
|
+
visibility: { type: "string", default: "private" },
|
|
301
310
|
force: { type: "boolean", default: false },
|
|
302
311
|
"skip-install": { type: "boolean", default: false },
|
|
303
312
|
yes: { type: "boolean", short: "y", default: false },
|
|
@@ -306,6 +315,7 @@ function parseOptions(argv) {
|
|
|
306
315
|
}
|
|
307
316
|
});
|
|
308
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}`;
|
|
309
319
|
return {
|
|
310
320
|
dir: positionals[0],
|
|
311
321
|
client: values.client,
|
|
@@ -315,6 +325,8 @@ function parseOptions(argv) {
|
|
|
315
325
|
description: values.description,
|
|
316
326
|
answers: values.answers,
|
|
317
327
|
dryRun: values["dry-run"] ?? false,
|
|
328
|
+
check: values.check ?? false,
|
|
329
|
+
visibility: values.visibility,
|
|
318
330
|
force: values.force ?? false,
|
|
319
331
|
skipInstall: values["skip-install"] ?? false,
|
|
320
332
|
yes: values.yes ?? false,
|
|
@@ -415,7 +427,9 @@ function layoutFor(project) {
|
|
|
415
427
|
{ template: "shared/tests/seo/coverage.test.ts", dest: "tests/seo/coverage.test.ts" },
|
|
416
428
|
{ template: "shared/tests/seo/redirects.test.ts", dest: "tests/seo/redirects.test.ts" },
|
|
417
429
|
{ template: "shared/tests/seo/graph.test.ts", dest: "tests/seo/graph.test.ts" },
|
|
418
|
-
{ 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` }
|
|
419
433
|
];
|
|
420
434
|
const siteKeys = {
|
|
421
435
|
facts: "site.facts.ts",
|
|
@@ -424,11 +438,18 @@ function layoutFor(project) {
|
|
|
424
438
|
"redirects.json": "redirects.json",
|
|
425
439
|
"site-adapter": `${base}lib/graph/site-adapter.ts`,
|
|
426
440
|
"page-graph": `${base}lib/graph/page-graph.ts`,
|
|
427
|
-
"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`
|
|
428
444
|
};
|
|
429
445
|
if (project.configFile) siteKeys["framework-config"] = project.configFile;
|
|
430
446
|
if (project.framework === "next") {
|
|
431
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
|
+
}));
|
|
432
453
|
return {
|
|
433
454
|
siteKeys,
|
|
434
455
|
templates: [
|
|
@@ -438,7 +459,9 @@ function layoutFor(project) {
|
|
|
438
459
|
{ template: "next/components/JsonLd.tsx", dest: `${base}components/JsonLd.tsx` },
|
|
439
460
|
{ template: "next/components/DesignerCredit.tsx", dest: `${base}components/DesignerCredit.tsx` },
|
|
440
461
|
{ template: "next/app/press/page.tsx", dest: `${project.routesDir}/press/page.tsx` },
|
|
441
|
-
{ 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
|
|
442
465
|
]
|
|
443
466
|
};
|
|
444
467
|
}
|
|
@@ -452,7 +475,9 @@ function layoutFor(project) {
|
|
|
452
475
|
{ template: "astro/components/JsonLd.astro", dest: "src/components/JsonLd.astro" },
|
|
453
476
|
{ template: "astro/components/DesignerCredit.astro", dest: "src/components/DesignerCredit.astro" },
|
|
454
477
|
{ template: "astro/pages/press.astro", dest: "src/pages/press.astro" },
|
|
455
|
-
{ 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` }))
|
|
456
481
|
]
|
|
457
482
|
};
|
|
458
483
|
}
|
|
@@ -565,6 +590,7 @@ function policyPatternsFor(bracketPath) {
|
|
|
565
590
|
}
|
|
566
591
|
|
|
567
592
|
// src/render/data.ts
|
|
593
|
+
var LEGAL_ROUTES = ["/accessibility", "/cookies", "/privacy", "/terms"];
|
|
568
594
|
var q = (value) => value === null ? "null" : JSON.stringify(value);
|
|
569
595
|
var arr = (values) => `[${values.map((v) => JSON.stringify(v)).join(", ")}]`;
|
|
570
596
|
function renderFacts(a, siteAdapterSpec) {
|
|
@@ -602,12 +628,30 @@ export const facts: SiteFacts = {
|
|
|
602
628
|
// { kind, name, url, status }. Only "live" profiles become sameAs.
|
|
603
629
|
profiles: [],
|
|
604
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
|
+
},
|
|
605
646
|
};
|
|
606
647
|
`;
|
|
607
648
|
}
|
|
608
649
|
function renderRoutes(routesOnDisk3, dynamicRoutesOnDisk3 = []) {
|
|
609
|
-
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();
|
|
610
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
|
+
}
|
|
611
655
|
const patterns = /* @__PURE__ */ new Map();
|
|
612
656
|
for (const route of dynamicRoutesOnDisk3) {
|
|
613
657
|
for (const pattern of policyPatternsFor(route)) if (pattern.endsWith("/*") && !patterns.has(pattern)) patterns.set(pattern, route);
|
|
@@ -647,6 +691,10 @@ export const trailLabels: TrailLabel[] = [
|
|
|
647
691
|
{ path: "/", label: "Home" },
|
|
648
692
|
{ path: "/press", label: "Press" },
|
|
649
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" },
|
|
650
698
|
];
|
|
651
699
|
|
|
652
700
|
/**
|
|
@@ -677,6 +725,22 @@ function renderRedirects() {
|
|
|
677
725
|
`;
|
|
678
726
|
}
|
|
679
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
|
+
|
|
680
744
|
// src/render/docs.ts
|
|
681
745
|
var run = (pm, script) => pm === "npm" ? `npm run ${script}` : `${pm} ${script}`;
|
|
682
746
|
function renderHouseMd(a, project) {
|
|
@@ -806,16 +870,17 @@ Started ${today}.
|
|
|
806
870
|
${rows.map(([measure, source]) => `| ${measure} | | | | | ${source} |`).join("\n")}
|
|
807
871
|
`;
|
|
808
872
|
}
|
|
809
|
-
function renderWorkflow(project) {
|
|
873
|
+
function renderWorkflow(project, visibility = "private") {
|
|
810
874
|
const pm = project.packageManager;
|
|
811
875
|
if (pm !== "pnpm" && pm !== "npm") return null;
|
|
812
|
-
const
|
|
813
|
-
- uses:
|
|
876
|
+
const runsOn = visibility === "public" ? "ubuntu-latest" : "${{ vars.CI_RUNNER || 'ubuntu-latest' }}";
|
|
877
|
+
const setup = pm === "pnpm" ? ` - uses: ${ACTIONS.setupPnpm}
|
|
878
|
+
- uses: ${ACTIONS.setupNode}
|
|
814
879
|
with:
|
|
815
880
|
node-version: '22.x'
|
|
816
881
|
cache: 'pnpm'
|
|
817
882
|
- run: pnpm install --frozen-lockfile
|
|
818
|
-
- run: pnpm seo:check` : ` - uses:
|
|
883
|
+
- run: pnpm seo:check` : ` - uses: ${ACTIONS.setupNode}
|
|
819
884
|
with:
|
|
820
885
|
node-version: '22.x'
|
|
821
886
|
cache: 'npm'
|
|
@@ -824,7 +889,10 @@ function renderWorkflow(project) {
|
|
|
824
889
|
return `name: seo-check
|
|
825
890
|
|
|
826
891
|
# The house SEO checks on every pull request: route coverage, redirects,
|
|
827
|
-
# 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.
|
|
828
896
|
|
|
829
897
|
on:
|
|
830
898
|
pull_request:
|
|
@@ -838,10 +906,12 @@ concurrency:
|
|
|
838
906
|
|
|
839
907
|
jobs:
|
|
840
908
|
seo:
|
|
841
|
-
runs-on:
|
|
909
|
+
runs-on: ${runsOn}
|
|
842
910
|
timeout-minutes: 10
|
|
843
911
|
steps:
|
|
844
|
-
- uses:
|
|
912
|
+
- uses: ${ACTIONS.checkout}
|
|
913
|
+
with:
|
|
914
|
+
persist-credentials: false
|
|
845
915
|
${setup}
|
|
846
916
|
`;
|
|
847
917
|
}
|
|
@@ -860,6 +930,24 @@ function websiteStatus(r) {
|
|
|
860
930
|
}
|
|
861
931
|
}
|
|
862
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
|
+
|
|
863
951
|
// src/templates.ts
|
|
864
952
|
import { readFileSync as readFileSync4 } from "fs";
|
|
865
953
|
import { dirname as dirname2, posix, relative } from "path";
|
|
@@ -880,17 +968,6 @@ function rewriteSiteImports(text2, dest, siteKeys) {
|
|
|
880
968
|
});
|
|
881
969
|
}
|
|
882
970
|
|
|
883
|
-
// src/versions.ts
|
|
884
|
-
var HOUSE_DEPENDENCIES = {
|
|
885
|
-
"@domandigital/graph": "^0.7.0",
|
|
886
|
-
"@domandigital/seo": "^0.3.0"
|
|
887
|
-
};
|
|
888
|
-
var HOUSE_DEV_DEPENDENCIES = {
|
|
889
|
-
"@domandigital/craft": "^0.17.0",
|
|
890
|
-
"@types/node": "^22.0.0",
|
|
891
|
-
vitest: "^4.1.11"
|
|
892
|
-
};
|
|
893
|
-
|
|
894
971
|
// templates/next/tests/seo/routes-on-disk.ts
|
|
895
972
|
var routes_on_disk_exports = {};
|
|
896
973
|
__export(routes_on_disk_exports, {
|
|
@@ -1027,7 +1104,7 @@ function planScaffold(project, answers, options) {
|
|
|
1027
1104
|
{ path: "docs/client-facts.entry.json", contents: renderStackEntry(answers, project.framework, options.today), data: true }
|
|
1028
1105
|
);
|
|
1029
1106
|
const workflowPath = ".github/workflows/seo-check.yml";
|
|
1030
|
-
const workflow = renderWorkflow(project);
|
|
1107
|
+
const workflow = renderWorkflow(project, options.visibility ?? "private");
|
|
1031
1108
|
if (existsSync5(join5(root, workflowPath)) || workflow && !hasWorkflows(root)) {
|
|
1032
1109
|
if (workflow) files.push({ path: workflowPath, contents: workflow, data: false });
|
|
1033
1110
|
} else if (!workflow) {
|
|
@@ -1064,6 +1141,13 @@ function planScaffold(project, answers, options) {
|
|
|
1064
1141
|
if (patched.kind === "patched") config = { file: project.configFile, text: patched.text };
|
|
1065
1142
|
if (patched.kind === "manual") notes.push(`${patched.reason}: ${MANUAL_INSTRUCTIONS[project.framework]}. tests/seo/config.test.ts fails until it does.`);
|
|
1066
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
|
+
}
|
|
1067
1151
|
const claudePath = join5(root, "CLAUDE.md");
|
|
1068
1152
|
const claudeText = existsSync5(claudePath) ? readFileSync5(claudePath, "utf8") : null;
|
|
1069
1153
|
const claudeMd = claudeText === null ? { text: `${HOUSE_IMPORT}
|
|
@@ -1079,6 +1163,7 @@ ${HOUSE_IMPORT}
|
|
|
1079
1163
|
files: planned,
|
|
1080
1164
|
packageJson: pkg.changes.length ? pkg : null,
|
|
1081
1165
|
config,
|
|
1166
|
+
pnpmWorkspace,
|
|
1082
1167
|
claudeMd,
|
|
1083
1168
|
commands,
|
|
1084
1169
|
craftInit,
|
|
@@ -1086,7 +1171,17 @@ ${HOUSE_IMPORT}
|
|
|
1086
1171
|
};
|
|
1087
1172
|
}
|
|
1088
1173
|
function hasWork(plan) {
|
|
1089
|
-
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;
|
|
1090
1185
|
}
|
|
1091
1186
|
var LABEL = {
|
|
1092
1187
|
create: "create ",
|
|
@@ -1106,6 +1201,7 @@ function formatPlan(plan, clientName) {
|
|
|
1106
1201
|
for (const f of plan.files) lines.push(` ${LABEL[f.action]} ${f.path}${SUFFIX[f.action] ?? ""}`);
|
|
1107
1202
|
if (plan.packageJson) lines.push(` patch package.json: ${plan.packageJson.changes.join(", ")}`);
|
|
1108
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)`);
|
|
1109
1205
|
if (plan.claudeMd) lines.push(` ${plan.claudeMd.created ? "create " : "patch "} CLAUDE.md: import docs/HOUSE.md`);
|
|
1110
1206
|
for (const c of plan.commands) lines.push(` run ${c.cmd} ${c.args.join(" ")}`);
|
|
1111
1207
|
if (plan.craftInit) lines.push(` run craft direction init --client ${JSON.stringify(clientName)}`);
|
|
@@ -1147,15 +1243,25 @@ ${USAGE}`);
|
|
|
1147
1243
|
},
|
|
1148
1244
|
file: options.answers,
|
|
1149
1245
|
cwd: io.cwd,
|
|
1150
|
-
ask: options.yes ? void 0 : io.ask
|
|
1246
|
+
ask: options.yes || options.check ? void 0 : io.ask
|
|
1151
1247
|
});
|
|
1152
1248
|
if (typeof answers === "string") {
|
|
1153
1249
|
io.err(`create-site: ${answers}`);
|
|
1154
1250
|
return 2;
|
|
1155
1251
|
}
|
|
1156
1252
|
const today = io.now().toISOString().slice(0, 10);
|
|
1157
|
-
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 });
|
|
1158
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
|
+
}
|
|
1159
1265
|
if (options.dryRun || !hasWork(plan)) return 0;
|
|
1160
1266
|
const pending = applyPlan(plan, answers.tradingName, io.exec);
|
|
1161
1267
|
const pm = project.packageManager === "npm" ? "npm run" : project.packageManager;
|
|
@@ -1164,7 +1270,9 @@ ${USAGE}`);
|
|
|
1164
1270
|
"",
|
|
1165
1271
|
"Next:",
|
|
1166
1272
|
" 1. Fill in site.facts.ts: contact details, hours, accreditations, profiles. Unknown stays null.",
|
|
1167
|
-
" 2. Put <DesignerCredit />
|
|
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.",
|
|
1168
1276
|
" 3. Work through docs/seo-launch-checklist.md.",
|
|
1169
1277
|
` 4. ${pm} seo:check now, and ${pm} launch:check before go-live.`,
|
|
1170
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
|
+
"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.
|
|
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>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The accessibility statement, from dd-base (Doman-Digital/dd-library). It
|
|
3
|
+
// states the standard the house builds to and the problems someone has
|
|
4
|
+
// actually found; it claims nothing it has not checked. A whole document:
|
|
5
|
+
// move it into your layout. Written by @domandigital/create-site.
|
|
6
|
+
import { isRouteIndexable } from "@domandigital/seo";
|
|
7
|
+
import JsonLd from "~site/components/JsonLd.astro";
|
|
8
|
+
import { facts } from "~site/facts";
|
|
9
|
+
import { legal } from "~site/legal";
|
|
10
|
+
import { buildPageGraph } from "~site/page-graph";
|
|
11
|
+
import { policy } from "~site/routes";
|
|
12
|
+
|
|
13
|
+
const title = `Accessibility: ${facts.tradingName}`;
|
|
14
|
+
const description = `How ${facts.tradingName} makes this website usable by everyone, and how to tell us when it is not.`;
|
|
15
|
+
const indexable = isRouteIndexable(policy, "/accessibility");
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<html lang="en-GB">
|
|
19
|
+
<head>
|
|
20
|
+
<meta charset="utf-8" />
|
|
21
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
22
|
+
<title>{title}</title>
|
|
23
|
+
<meta name="description" content={description} />
|
|
24
|
+
{!indexable && <meta name="robots" content="noindex" />}
|
|
25
|
+
<JsonLd graph={buildPageGraph({ path: "/accessibility", name: title, description })} />
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<main>
|
|
29
|
+
<h1>Accessibility</h1>
|
|
30
|
+
{legal.reviewedOn && <p>Last reviewed {legal.reviewedOn}.</p>}
|
|
31
|
+
|
|
32
|
+
<section>
|
|
33
|
+
<h2>The standard we build to</h2>
|
|
34
|
+
<p>We aim for this site to meet the Web Content Accessibility Guidelines (WCAG) 2.2 at level AA. That means:</p>
|
|
35
|
+
<ul>
|
|
36
|
+
<li>text has enough contrast against its background</li>
|
|
37
|
+
<li>everything works with a keyboard</li>
|
|
38
|
+
<li>images that carry meaning have a text alternative</li>
|
|
39
|
+
<li>movement stops when your device asks for reduced motion</li>
|
|
40
|
+
<li>headings follow the order of the page</li>
|
|
41
|
+
<li>form fields have visible labels and clear error messages</li>
|
|
42
|
+
</ul>
|
|
43
|
+
</section>
|
|
44
|
+
|
|
45
|
+
{legal.accessibilityIssues.length > 0 && (
|
|
46
|
+
<section>
|
|
47
|
+
<h2>Problems we know about</h2>
|
|
48
|
+
<ul>
|
|
49
|
+
{legal.accessibilityIssues.map((issue) => <li>{issue}</li>)}
|
|
50
|
+
</ul>
|
|
51
|
+
</section>
|
|
52
|
+
)}
|
|
53
|
+
|
|
54
|
+
{facts.email && (
|
|
55
|
+
<section>
|
|
56
|
+
<h2>Tell us about a problem</h2>
|
|
57
|
+
<p>
|
|
58
|
+
If something on the site does not work for you, email <a href={`mailto:${facts.email}`}>{facts.email}</a> and
|
|
59
|
+
we will put it right.
|
|
60
|
+
</p>
|
|
61
|
+
</section>
|
|
62
|
+
)}
|
|
63
|
+
</main>
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The cookie policy, from dd-base (Doman-Digital/dd-library). The third
|
|
3
|
+
// parties are the processors in site.facts.ts that set cookies. The button
|
|
4
|
+
// brings back the banner the site's layout carries. A whole document: move
|
|
5
|
+
// it into your layout. Written by @domandigital/create-site.
|
|
6
|
+
import { isRouteIndexable } from "@domandigital/seo";
|
|
7
|
+
import JsonLd from "~site/components/JsonLd.astro";
|
|
8
|
+
import { facts } from "~site/facts";
|
|
9
|
+
import { legal, privacyEmail } from "~site/legal";
|
|
10
|
+
import { buildPageGraph } from "~site/page-graph";
|
|
11
|
+
import { policy } from "~site/routes";
|
|
12
|
+
|
|
13
|
+
const title = `Cookie policy: ${facts.tradingName}`;
|
|
14
|
+
const description = `How ${facts.tradingName} uses cookies, and how to change your choice.`;
|
|
15
|
+
const indexable = isRouteIndexable(policy, "/cookies");
|
|
16
|
+
const thirdParties = legal.processors.filter((p) => p.setsCookies);
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<html lang="en-GB">
|
|
20
|
+
<head>
|
|
21
|
+
<meta charset="utf-8" />
|
|
22
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
23
|
+
<title>{title}</title>
|
|
24
|
+
<meta name="description" content={description} />
|
|
25
|
+
{!indexable && <meta name="robots" content="noindex" />}
|
|
26
|
+
<JsonLd graph={buildPageGraph({ path: "/cookies", name: title, description })} />
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<main>
|
|
30
|
+
<h1>Cookie policy</h1>
|
|
31
|
+
{legal.reviewedOn && <p>Last reviewed {legal.reviewedOn}.</p>}
|
|
32
|
+
|
|
33
|
+
<section>
|
|
34
|
+
<h2>What cookies are</h2>
|
|
35
|
+
<p>Cookies are small files a website stores in your browser, to make the site work or to learn how it is used.</p>
|
|
36
|
+
</section>
|
|
37
|
+
|
|
38
|
+
<section>
|
|
39
|
+
<h2>What we use</h2>
|
|
40
|
+
<p>
|
|
41
|
+
<strong>Strictly necessary.</strong> Needed for the site to work, including the one that remembers your cookie
|
|
42
|
+
choice. These do not need your consent.
|
|
43
|
+
</p>
|
|
44
|
+
<p>
|
|
45
|
+
<strong>Measurement.</strong> Off until you choose "Accept measurement". They count visits and where they come
|
|
46
|
+
from.
|
|
47
|
+
</p>
|
|
48
|
+
</section>
|
|
49
|
+
|
|
50
|
+
{thirdParties.length > 0 && (
|
|
51
|
+
<section>
|
|
52
|
+
<h2>Other companies' cookies</h2>
|
|
53
|
+
<ul>
|
|
54
|
+
{thirdParties.map((p) => <li>{p.name}: {p.purpose}</li>)}
|
|
55
|
+
</ul>
|
|
56
|
+
</section>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
<section>
|
|
60
|
+
<h2>Changing your choice</h2>
|
|
61
|
+
<p>You can change your choice at any time.</p>
|
|
62
|
+
<button type="button" data-cookie-settings>Change cookie settings</button>
|
|
63
|
+
{privacyEmail && <p>Questions about cookies: <a href={`mailto:${privacyEmail}`}>{privacyEmail}</a>.</p>}
|
|
64
|
+
</section>
|
|
65
|
+
</main>
|
|
66
|
+
<script>
|
|
67
|
+
import { openCookieSettings } from "~site/consent";
|
|
68
|
+
|
|
69
|
+
document.querySelectorAll("[data-cookie-settings]").forEach((el) => el.addEventListener("click", openCookieSettings));
|
|
70
|
+
</script>
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|