@domandigital/create-site 0.3.1 → 0.4.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,21 @@
1
1
  # @domandigital/create-site
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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.
8
+
9
+ ### Patch Changes
10
+
11
+ - ef257c9: New sites install `@domandigital/craft` `^0.17.0`, to follow the craft release that adds `craft register`.
12
+
13
+ ## 0.3.2
14
+
15
+ ### Patch Changes
16
+
17
+ - 6545c2e: New sites install `@domandigital/craft` at `^0.16.0`, the release that adds `craft calibrate` and `craft null import`.
18
+
3
19
  ## 0.3.1
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -38,6 +38,7 @@ it is copied, which is the failure this exists to avoid.
38
38
  | `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
39
  | `docs/HOUSE.md` | The house rules, imported by `CLAUDE.md` (created if missing, otherwise one import line is added) |
40
40
  | `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
+ | `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 |
41
42
  | `.github/workflows/seo-check.yml` | Only if the project has no workflows yet |
42
43
  | `package.json` | `seo:check` and `launch:check` scripts, and the house packages |
43
44
 
@@ -69,7 +70,13 @@ create-site [dir] [--client <legal name>] [--trading-name <name>]
69
70
  `--answers` takes a JSON file with any of `legalName`, `tradingName`,
70
71
  `siteUrl`, `sector`, `description`, `phone`, `email`, `locality`,
71
72
  `postalCode`, `serviceAreas`, `registers` (ids from `src/sectors.ts`) and
72
- `previousHosts`.
73
+ `previousHosts`, and the declared technology: `host`, `dns`, `cms`,
74
+ `analytics` (a list, e.g. `["ga4", "gtm", "posthog"]`), `errorMonitoring` and
75
+ `emailSending` (a list). Each can be skipped, and a skipped one is left out of
76
+ `docs/client-facts.entry.json`, never filled with a guess. Common names are
77
+ mapped to the register's (`Google Analytics` becomes `ga4`); anything that
78
+ cannot be a register name (lowercase letters, digits, dots, hyphens) stops the
79
+ run with exit code 2 before anything is written.
73
80
 
74
81
  Exit codes: 0 done, 1 refused (nothing written), 2 usage error.
75
82
 
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
 
@@ -695,6 +779,7 @@ ${rest.map(line).join("\n")}
695
779
 
696
780
  - [ ] 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
781
  - [ ] \`launch:check\` passes.
782
+ - [ ] The site is in Doman Digital's client register: \`docs/client-facts.entry.json\` handed over with every null filled in.
698
783
  - [ ] Search Console property verified and the sitemap submitted.
699
784
  - [ ] The launch column of \`docs/seo-baseline.md\` filled in.
700
785
  `;
@@ -801,7 +886,7 @@ var HOUSE_DEPENDENCIES = {
801
886
  "@domandigital/seo": "^0.3.0"
802
887
  };
803
888
  var HOUSE_DEV_DEPENDENCIES = {
804
- "@domandigital/craft": "^0.15.0",
889
+ "@domandigital/craft": "^0.17.0",
805
890
  "@types/node": "^22.0.0",
806
891
  vitest: "^4.1.11"
807
892
  };
@@ -917,6 +1002,9 @@ function planScaffold(project, answers, options) {
917
1002
  const layout = layoutFor(project);
918
1003
  const notes = [];
919
1004
  if (project.packageManagerWarning) notes.push(project.packageManagerWarning);
1005
+ notes.push(
1006
+ "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)."
1007
+ );
920
1008
  const files = [];
921
1009
  for (const t of layout.templates) {
922
1010
  if (t.template.endsWith("config.test.ts") && !project.configFile) {
@@ -935,7 +1023,8 @@ function planScaffold(project, answers, options) {
935
1023
  { path: "docs/HOUSE.md", contents: renderHouseMd(answers, project), data: false },
936
1024
  { path: "docs/DIRECTION.md", contents: renderDirection(answers, options.today), data: true },
937
1025
  { path: "docs/seo-launch-checklist.md", contents: renderChecklist(answers), data: true },
938
- { path: "docs/seo-baseline.md", contents: renderBaseline(answers, options.today), data: true }
1026
+ { path: "docs/seo-baseline.md", contents: renderBaseline(answers, options.today), data: true },
1027
+ { path: "docs/client-facts.entry.json", contents: renderStackEntry(answers, project.framework, options.today), data: true }
939
1028
  );
940
1029
  const workflowPath = ".github/workflows/seo-check.yml";
941
1030
  const workflow = renderWorkflow(project);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domandigital/create-site",
3
- "version": "0.3.1",
3
+ "version": "0.4.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.15.0",
44
+ "@domandigital/craft": "^0.17.0",
45
45
  "@domandigital/graph": "^0.7.0",
46
46
  "@domandigital/seo": "^0.3.1"
47
47
  },