@domandigital/create-site 0.12.0 → 0.12.3

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,23 @@
1
1
  # @domandigital/create-site
2
2
 
3
+ ## 0.12.3
4
+
5
+ ### Patch Changes
6
+
7
+ - c31349e: New sites install craft ^0.25.0, which adds the sideways-row check to the phone measure.
8
+
9
+ ## 0.12.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 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.
14
+
15
+ ## 0.12.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 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.
20
+
3
21
  ## 0.12.0
4
22
 
5
23
  ### Minor Changes
package/dist/cli.js CHANGED
@@ -285,10 +285,12 @@ function pieceOf(template) {
285
285
  for (const piece of VISIBLE_PIECES) if (PIECE_FILES[piece].test(path)) return piece;
286
286
  return null;
287
287
  }
288
+ function pieceInstalled(piece, handover) {
289
+ return !handover || handover.with.includes(piece);
290
+ }
288
291
  function installs(template, handover) {
289
- if (!handover) return true;
290
292
  const piece = pieceOf(template);
291
- return piece === null || handover.with.includes(piece);
293
+ return piece === null || pieceInstalled(piece, handover);
292
294
  }
293
295
 
294
296
  // src/args.ts
@@ -788,10 +790,13 @@ export const facts: SiteFacts = {
788
790
  };
789
791
  `;
790
792
  }
791
- function renderRoutes(routesOnDisk3, dynamicRoutesOnDisk3 = []) {
792
- 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();
793
797
  const entries = routes.map((path) => ` { path: ${JSON.stringify(path)}, indexable: true, inSitemap: true },`);
794
798
  for (const path of LEGAL_ROUTES) {
799
+ if (!listed("legal", path)) continue;
795
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." },`);
796
801
  }
797
802
  const patterns = /* @__PURE__ */ new Map();
@@ -805,9 +810,9 @@ function renderRoutes(routesOnDisk3, dynamicRoutesOnDisk3 = []) {
805
810
  )} },`
806
811
  );
807
812
  }
808
- entries.push(
809
- ` { path: "/resources", indexable: false, inSitemap: false, reason: "Empty until the first linkable asset ships. Index it then." },`
810
- );
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
+ }
811
816
  return `// Every page on the site, what it is trying to rank for, and how pages
812
817
  // link to each other. Add a policy entry in the same change that adds a
813
818
  // page: tests/seo/coverage.test.ts fails until you do. Every path and
@@ -909,7 +914,7 @@ var HOUSE_DEPENDENCIES = {
909
914
  "@domandigital/seo": "^0.3.0"
910
915
  };
911
916
  var HOUSE_DEV_DEPENDENCIES = {
912
- "@domandigital/craft": "^0.24.0",
917
+ "@domandigital/craft": "^0.25.0",
913
918
  "@types/node": "^22.0.0",
914
919
  vitest: "^4.1.11",
915
920
  // scripts/gates/measure.mjs renders the pages at every viewport, phone first,
@@ -1271,7 +1276,7 @@ function planScaffold(project, answers, options) {
1271
1276
  const enumerate = project.framework === "next" ? routes_on_disk_exports : routes_on_disk_exports2;
1272
1277
  files.push(
1273
1278
  { path: "site.facts.ts", contents: renderFacts(answers, adapterSpec), data: true },
1274
- { 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 },
1275
1280
  { path: "links.json", contents: renderLinks(), data: true },
1276
1281
  { path: "redirects.json", contents: renderRedirects(), data: true },
1277
1282
  { path: "docs/HOUSE.md", contents: renderHouseMd(answers, project), data: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domandigital/create-site",
3
- "version": "0.12.0",
3
+ "version": "0.12.3",
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": "^4.0.0",
44
- "@domandigital/craft": "^0.24.3",
44
+ "@domandigital/craft": "^0.25.0",
45
45
  "@domandigital/graph": "^0.7.1",
46
46
  "@domandigital/seo": "^0.3.2"
47
47
  },
@@ -110,10 +110,22 @@ function publicDestinations(app) {
110
110
  return [app.domain, ...(app.destinations || []).filter(d => d.type === "public").map(d => d.uri)].filter(Boolean);
111
111
  }
112
112
 
113
- function matchesHost(destination, hostname) {
113
+ export function matchesHost(destination, hostname) {
114
114
  const host = destination.split("/")[0].toLowerCase();
115
- const escaped = host.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
116
- 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);
117
129
  }
118
130
 
119
131
  export function validateAccessState(protection, state, registry) {