create-ailk 0.46.6 → 0.48.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/README.md +180 -43
- package/component-catalog.json +223 -285
- package/component-catalog.md +1 -1
- package/dist/apply-design.d.ts +26 -68
- package/dist/apply-design.js +150 -322
- package/dist/cli.js +152 -17
- package/dist/compare-chrome.d.ts +108 -0
- package/dist/compare-chrome.js +481 -0
- package/dist/compare-look.d.ts +94 -0
- package/dist/compare-look.js +378 -0
- package/dist/copy.js +1 -1
- package/dist/design-compile.d.ts +17 -21
- package/dist/design-compile.js +32 -56
- package/dist/design-files.d.ts +93 -0
- package/dist/design-files.js +312 -0
- package/dist/design-home.d.ts +4 -2
- package/dist/design-home.js +88 -6
- package/dist/design-names.d.ts +13 -0
- package/dist/design-names.js +76 -0
- package/dist/design-package.d.ts +46 -56
- package/dist/design-package.js +285 -288
- package/dist/design-presets.d.ts +41 -0
- package/dist/design-presets.js +83 -4
- package/dist/design-scaffold.d.ts +12 -2
- package/dist/design-scaffold.js +72 -34
- package/dist/generated/design-settings.d.ts +56 -0
- package/dist/generated/design-settings.js +237 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/inventory.d.ts +3 -2
- package/dist/inventory.js +10 -4
- package/dist/lib/design-checks.d.ts +46 -0
- package/dist/lib/design-checks.js +79 -1
- package/dist/lib/env-catalog.js +5 -1
- package/dist/lib/module-license-gate.d.ts +1 -1
- package/dist/lib/module-license-gate.js +1 -1
- package/dist/lib/render-verdict.d.ts +13 -1
- package/dist/lib/render-verdict.js +41 -1
- package/dist/look-hub.d.ts +44 -0
- package/dist/look-hub.js +130 -0
- package/dist/look-record.d.ts +35 -0
- package/dist/look-record.js +85 -0
- package/dist/look-samples.d.ts +66 -0
- package/dist/look-samples.js +456 -0
- package/dist/look-settings.d.ts +53 -0
- package/dist/look-settings.js +363 -0
- package/dist/module-architecture.js +12 -0
- package/dist/parse-args.d.ts +10 -6
- package/dist/parse-args.js +26 -13
- package/dist/programmatic.d.ts +1 -19
- package/dist/programmatic.js +65 -103
- package/dist/retired-design-bodies.d.ts +29 -0
- package/dist/retired-design-bodies.js +51 -0
- package/dist/seed-flows.d.ts +1 -1
- package/dist/seed-flows.js +12 -14
- package/dist/seed-workspace.d.ts +4 -1
- package/dist/seed-workspace.js +139 -17
- package/dist/site-chrome.d.ts +41 -41
- package/dist/site-chrome.js +50 -70
- package/dist/site-fonts.d.ts +10 -14
- package/dist/site-fonts.js +5 -1
- package/dist/starter-grid.d.ts +2 -2
- package/dist/strip-look-copies.d.ts +67 -0
- package/dist/strip-look-copies.js +591 -0
- package/dist/template-manifest.d.ts +6 -14
- package/dist/template-manifest.js +0 -9
- package/dist/template-record.d.ts +3 -1
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +15 -0
- package/dist/topology.js +60 -0
- package/dist/update.d.ts +57 -1
- package/dist/update.js +742 -13
- package/package.json +3 -4
- package/site-templates/aliases/hub.TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/designs/minimalism/DESIGN.md +163 -297
- package/site-templates/designs/minimalism/LOOK.md +42 -0
- package/site-templates/designs/minimalism/design.yaml +167 -0
- package/site-templates/designs/standard/DESIGN.md +145 -149
- package/site-templates/designs/standard/LOOK.md +42 -0
- package/site-templates/designs/standard/design.yaml +72 -0
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/content/_site.mdx +0 -26
- package/templates/.claude/rules/extending.md +3 -2
- package/templates/.env.example +11 -4
- package/templates/CLAUDE.md +1 -1
- package/templates/DESIGN.md +145 -149
- package/templates/README.md +15 -16
- package/templates/apps/api/.env.example +29 -4
- package/templates/apps/api/CLAUDE.md +7 -4
- package/templates/apps/api/src/__tests__/vercel-handler.test.ts +176 -2
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +30 -4
- package/templates/apps/api/src/vercel-handler.ts +32 -2
- package/templates/apps/mcp/.env.example +8 -0
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/.env.example +10 -3
- package/templates/apps/web/CLAUDE.md +31 -4
- package/templates/apps/web/app/[locale]/layout.tsx +141 -77
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +13 -3
- package/templates/apps/web/app/not-found.tsx +11 -11
- package/templates/apps/web/auth.ts +48 -35
- package/templates/apps/web/jest.config.cjs +5 -0
- package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +542 -10
- package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
- package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +233 -0
- package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
- package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
- package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +19 -1
- package/templates/apps/web/lib/__tests__/site-navigation.test.ts +288 -0
- package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
- package/templates/apps/web/lib/deck-page.ts +3 -10
- package/templates/apps/web/lib/deploy-fonts.ts +12 -0
- package/templates/apps/web/lib/hub-site-config.ts +237 -29
- package/templates/apps/web/lib/library-fonts.ts +41 -0
- package/templates/apps/web/lib/mcp-oauth.ts +11 -4
- package/templates/apps/web/lib/page-chrome.ts +105 -20
- package/templates/apps/web/lib/section-look.ts +28 -0
- package/templates/apps/web/lib/site-design.ts +205 -0
- package/templates/apps/web/lib/site-navigation.ts +208 -0
- package/templates/apps/web/lib/site-theme-head.ts +98 -13
- package/templates/apps/web/lib/site-theme.ts +40 -62
- package/templates/apps/web/messages/en.json +0 -6
- package/templates/apps/web/next.config.mjs +213 -11
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/site-pages.config.tsx +4 -2
- package/templates/content/_site.mdx +0 -26
- package/templates/design.yaml +75 -0
- package/templates/project.yaml +14 -0
- package/versions.json +52 -51
- package/site-templates/marketing-site/DESIGN.md +0 -259
- package/site-templates/marketing-site-free/DESIGN.md +0 -259
- package/site-templates/saas-product/DESIGN.md +0 -259
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
- package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
- package/templates/apps/web/lib/site-chrome.ts +0 -46
- package/templates/apps/web/lib/site-fonts.ts +0 -15
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Site theme — reads the `
|
|
3
|
-
* translates it into the token overlay `themeToCssVarsBothModes` accepts.
|
|
2
|
+
* Site theme — reads the brand triad (`brand:`) out of `content/_site.mdx`
|
|
3
|
+
* and translates it into the token overlay `themeToCssVarsBothModes` accepts.
|
|
4
|
+
*
|
|
5
|
+
* `_site.mdx`'s `theme:` is not read (#12477 D2): a site's look is its hub
|
|
6
|
+
* design record's (`lib/site-design.ts`), and with none the page renders the
|
|
7
|
+
* base look — `@working-theory/theme`'s defaults under this triad.
|
|
4
8
|
*
|
|
5
9
|
* The read is a local frontmatter parse rather than
|
|
6
10
|
* `@working-theory/site-config/server`'s `loadSiteConfig`, for the same
|
|
7
11
|
* reason `site-brand.tsx` reads locally (see its header, and #4157 D1) and
|
|
8
12
|
* one more: `architecture.yaml` forbids `apps/web` from importing that
|
|
9
13
|
* subpath at all, because it pulls `node:fs` into a tree that also carries
|
|
10
|
-
* edge routes (#1567). The `
|
|
11
|
-
* canonical schema
|
|
12
|
-
* `/schema` entry — so the shape this app accepts and the shape the
|
|
13
|
-
* dashboard will write are one definition, not two.
|
|
14
|
+
* edge routes (#1567). The `brand:` block is validated against the
|
|
15
|
+
* canonical schema (`BrandSchema` from `@working-theory/site-config/schema`).
|
|
14
16
|
*
|
|
15
17
|
* The translation itself lives in `@working-theory/theme`
|
|
16
|
-
* (`
|
|
17
|
-
*
|
|
18
|
-
* The brand triad (#6820) — `brand.colors` and `brand.fonts`, a sibling of
|
|
19
|
-
* `theme:` that applying a design never rewrites — is read in the same parse
|
|
20
|
-
* and layered over the theme by `siteBrandToBrandTokens`.
|
|
18
|
+
* (`siteBrandToBrandTokens`) — the token vocabulary is that package's own.
|
|
21
19
|
*
|
|
22
|
-
* Returns `undefined` when the site declares no
|
|
23
|
-
*
|
|
24
|
-
* CSS it emitted before this wiring existed.
|
|
20
|
+
* Returns `undefined` when the site declares no triad, so the layout passes
|
|
21
|
+
* no `brand` at all and the resolver emits `@working-theory/theme`'s defaults.
|
|
25
22
|
*/
|
|
26
23
|
|
|
27
24
|
import { readFileSync } from "node:fs";
|
|
28
25
|
import { join } from "node:path";
|
|
29
26
|
|
|
30
|
-
import { BrandSchema
|
|
27
|
+
import { BrandSchema } from "@working-theory/site-config/schema";
|
|
31
28
|
import {
|
|
32
29
|
siteBrandToBrandTokens,
|
|
33
|
-
siteThemeScopedDarkCss,
|
|
34
|
-
siteThemeShapeCss,
|
|
35
30
|
type BrandTokenOverrides,
|
|
31
|
+
type SiteBrand,
|
|
36
32
|
} from "@working-theory/theme";
|
|
37
33
|
import { parse as parseYaml } from "yaml";
|
|
38
34
|
import { z } from "zod";
|
|
@@ -41,7 +37,7 @@ import { resolveContentRoot } from "./site-brand";
|
|
|
41
37
|
|
|
42
38
|
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
|
|
43
39
|
|
|
44
|
-
const SOURCE = "content/_site.mdx
|
|
40
|
+
const SOURCE = "content/_site.mdx brand";
|
|
45
41
|
|
|
46
42
|
/**
|
|
47
43
|
* `brand:` as this loader validates it: every key checked by name, but the
|
|
@@ -53,65 +49,47 @@ const BrandTriadSchema = BrandSchema.extend({
|
|
|
53
49
|
}).strict();
|
|
54
50
|
|
|
55
51
|
/**
|
|
56
|
-
* The `
|
|
57
|
-
* `
|
|
58
|
-
*
|
|
59
|
-
*
|
|
52
|
+
* The `brand:` value as it appears in the frontmatter, `undefined` when
|
|
53
|
+
* `_site.mdx` is absent, unreadable, or does not declare it. A site with no
|
|
54
|
+
* readable config has no triad to apply, and the default palette is the
|
|
55
|
+
* correct result — the same fallback `site-brand.tsx` takes.
|
|
60
56
|
*
|
|
61
|
-
* "Does not declare it" covers a bare `
|
|
62
|
-
* which YAML parses to `null
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* rather than reaching the schema and throwing out of a Server Component.
|
|
57
|
+
* "Does not declare it" covers a bare `brand:` key with nothing under it,
|
|
58
|
+
* which YAML parses to `null`: it means exactly what an absent key means, so
|
|
59
|
+
* it takes the same path rather than reaching the schema and throwing out of
|
|
60
|
+
* a Server Component.
|
|
66
61
|
*/
|
|
67
|
-
function readSiteBlocks(): {
|
|
62
|
+
function readSiteBlocks(): { brand: unknown } {
|
|
68
63
|
try {
|
|
69
64
|
const raw = readFileSync(join(resolveContentRoot(), "_site.mdx"), "utf8");
|
|
70
65
|
const match = FRONTMATTER_RE.exec(raw);
|
|
71
|
-
if (!match) return {
|
|
66
|
+
if (!match) return { brand: undefined };
|
|
72
67
|
|
|
73
68
|
const parsed: unknown = parseYaml(match[1] ?? "");
|
|
74
|
-
if (!parsed || typeof parsed !== "object") {
|
|
75
|
-
return { theme: undefined, brand: undefined };
|
|
76
|
-
}
|
|
69
|
+
if (!parsed || typeof parsed !== "object") return { brand: undefined };
|
|
77
70
|
|
|
78
|
-
const {
|
|
79
|
-
return {
|
|
71
|
+
const { brand } = parsed as Record<string, unknown>;
|
|
72
|
+
return { brand: brand ?? undefined };
|
|
80
73
|
} catch {
|
|
81
|
-
return {
|
|
74
|
+
return { brand: undefined };
|
|
82
75
|
}
|
|
83
76
|
}
|
|
84
77
|
|
|
78
|
+
/**
|
|
79
|
+
* The `brand:` block, parsed exactly as `loadSiteBrandTokens` parses it, for
|
|
80
|
+
* the hub design record to fall back to part by part (#12473 D2). Throws as
|
|
81
|
+
* that loader does.
|
|
82
|
+
*/
|
|
83
|
+
export function loadSiteThemeBlocks(): { brand?: SiteBrand } {
|
|
84
|
+
const blocks = readSiteBlocks();
|
|
85
|
+
return blocks.brand !== undefined ? { brand: BrandTriadSchema.parse(blocks.brand) } : {};
|
|
86
|
+
}
|
|
87
|
+
|
|
85
88
|
export function loadSiteBrandTokens(): BrandTokenOverrides | undefined {
|
|
86
89
|
const blocks = readSiteBlocks();
|
|
87
|
-
if (blocks.
|
|
90
|
+
if (blocks.brand === undefined) return undefined;
|
|
88
91
|
|
|
89
92
|
// Validation failures and unsupported colours BOTH throw, deliberately: a
|
|
90
93
|
// customer who set a colour and saw no change would have been lied to.
|
|
91
|
-
|
|
92
|
-
blocks.theme === undefined ? undefined : SiteThemeSchema.parse(blocks.theme);
|
|
93
|
-
const brand =
|
|
94
|
-
blocks.brand === undefined ? undefined : BrandTriadSchema.parse(blocks.brand);
|
|
95
|
-
return siteBrandToBrandTokens(theme, brand, SOURCE);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The site's shape settings (`theme.corners`, `theme.eyebrowCase`) as a CSS
|
|
100
|
-
* override block for `:root`. "" when the site sets neither.
|
|
101
|
-
*
|
|
102
|
-
* #7719 D6 — a theme with `darkBands: "site"` also gets its own dark palette
|
|
103
|
-
* on every dark-scoped band below the root (`siteThemeScopedDarkCss`), built
|
|
104
|
-
* from the overlay the root rule carries (the `brand:` triad included). Only
|
|
105
|
-
* mode-variant tokens are re-declared, so the shape settings above still
|
|
106
|
-
* reach inside the band.
|
|
107
|
-
* Without it the string is today's.
|
|
108
|
-
*/
|
|
109
|
-
export function loadSiteShapeCss(): string {
|
|
110
|
-
const { theme } = readSiteBlocks();
|
|
111
|
-
if (theme === undefined) return "";
|
|
112
|
-
const parsed = SiteThemeSchema.parse(theme);
|
|
113
|
-
const shape = siteThemeShapeCss(parsed);
|
|
114
|
-
if (parsed.darkBands !== "site") return shape;
|
|
115
|
-
const brand = loadSiteBrandTokens();
|
|
116
|
-
return brand ? shape + siteThemeScopedDarkCss(parsed, brand) : shape;
|
|
94
|
+
return siteBrandToBrandTokens(undefined, BrandTriadSchema.parse(blocks.brand), SOURCE);
|
|
117
95
|
}
|
|
@@ -376,12 +376,6 @@
|
|
|
376
376
|
"seoHeading": "SEO",
|
|
377
377
|
"seoDescription": "Meta description",
|
|
378
378
|
"seoOgImage": "Social share image URL",
|
|
379
|
-
"themeHeading": "Theme",
|
|
380
|
-
"themeLightPrimary": "Primary colour (light)",
|
|
381
|
-
"themeLightAccent": "Accent colour (light)",
|
|
382
|
-
"themeDarkPrimary": "Primary colour (dark)",
|
|
383
|
-
"themeDarkAccent": "Accent colour (dark)",
|
|
384
|
-
"themeUnconfigured": "This site uses the default theme. Colours become editable once a theme is configured for the workspace.",
|
|
385
379
|
"saveButton": "Save",
|
|
386
380
|
"saving": "Saving…",
|
|
387
381
|
"saved": "Saved",
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import { parse as parseYaml } from "yaml";
|
|
4
5
|
import bundleAnalyzer from "@next/bundle-analyzer";
|
|
5
6
|
import { withSentryConfig } from "@sentry/nextjs";
|
|
6
7
|
import createNextIntlPlugin from "next-intl/plugin";
|
|
8
|
+
import { PHASE_PRODUCTION_BUILD } from "next/constants.js";
|
|
9
|
+
import {
|
|
10
|
+
apiBaseConfigured,
|
|
11
|
+
getApiBase,
|
|
12
|
+
isSafeTransport,
|
|
13
|
+
sendsSpokeKey,
|
|
14
|
+
siteConfig,
|
|
15
|
+
} from "@working-theory/api-client";
|
|
7
16
|
import { DocsPathSchema, ServicesPathSchema, SiteConfigSchema } from "@working-theory/site-config/schema";
|
|
8
17
|
import {
|
|
9
18
|
legacyRedirects,
|
|
@@ -11,7 +20,14 @@ import {
|
|
|
11
20
|
ROUTES,
|
|
12
21
|
SERVICES_ROUTE,
|
|
13
22
|
} from "@working-theory/templates/routes";
|
|
14
|
-
import {
|
|
23
|
+
import { compileDesignFonts, fontTakesEffect } from "@working-theory/theme";
|
|
24
|
+
import {
|
|
25
|
+
assetImageConfigWarning,
|
|
26
|
+
assetRemotePattern,
|
|
27
|
+
designSettingsSchema,
|
|
28
|
+
siteDesignSchema,
|
|
29
|
+
unquoteFamily,
|
|
30
|
+
} from "@working-theory/validation";
|
|
15
31
|
import { parseStealth } from "@working-theory/web-i18n/stealth";
|
|
16
32
|
import { withBotId } from "botid/next/config";
|
|
17
33
|
|
|
@@ -401,10 +417,20 @@ process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = routePathsAtBuild;
|
|
|
401
417
|
// which the hub resolves to its own `/v1/assets/:id` URLs. `next/image` admits
|
|
402
418
|
// that path on the hub's origin, and nothing else, when `AILK_API_URL` (the
|
|
403
419
|
// server-side hub origin this site already reads) is an http(s) URL at build
|
|
404
|
-
// time; otherwise there
|
|
405
|
-
//
|
|
420
|
+
// time; otherwise there are no remote patterns. A change of hub origin needs a
|
|
421
|
+
// rebuild.
|
|
422
|
+
//
|
|
423
|
+
// #12428 D4 (M3) — `minimumCacheTTL: 60` always, in place of Next's four-hour
|
|
424
|
+
// default, so a made-private, disabled or deleted image leaves this site's
|
|
425
|
+
// image cache within a minute of the hub and the store dropping it.
|
|
406
426
|
const assetPatternAtBuild = assetRemotePattern(process.env.AILK_API_URL);
|
|
407
427
|
|
|
428
|
+
// #12420 D7 — every site that reads hub pages needs that origin, not only a
|
|
429
|
+
// spoke: a database site built without it is told so, once, by name. It
|
|
430
|
+
// reads `CONTENT_ADAPTER` and `AILK_API_URL` only.
|
|
431
|
+
const assetConfigWarning = assetImageConfigWarning(process.env);
|
|
432
|
+
if (assetConfigWarning !== null) console.warn(`[next.config] ${assetConfigWarning}`);
|
|
433
|
+
|
|
408
434
|
/** @type {import('next').NextConfig} */
|
|
409
435
|
const nextConfig = {
|
|
410
436
|
reactStrictMode: true,
|
|
@@ -519,9 +545,12 @@ const nextConfig = {
|
|
|
519
545
|
// mutates a tracked file as a side effect of running the dev server,
|
|
520
546
|
// which this scaffold does not want.
|
|
521
547
|
agentRules: false,
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
548
|
+
images: {
|
|
549
|
+
minimumCacheTTL: 60,
|
|
550
|
+
...(assetPatternAtBuild === null
|
|
551
|
+
? {}
|
|
552
|
+
: { remotePatterns: [assetPatternAtBuild] }),
|
|
553
|
+
},
|
|
525
554
|
env: {
|
|
526
555
|
// Comma-separated locale list baked at build time — consumed by middleware
|
|
527
556
|
// and the sitemap route. NEXT_PUBLIC_ prefix makes it available in Edge
|
|
@@ -584,6 +613,173 @@ const sentryBuildOptions = {
|
|
|
584
613
|
: {}),
|
|
585
614
|
};
|
|
586
615
|
|
|
616
|
+
// ── #12473 D7 — a face outside the design library, built in at the next deploy ──
|
|
617
|
+
//
|
|
618
|
+
// On a hub-connected production build, the hub's design record is read once
|
|
619
|
+
// (5 s bound) and `lib/deploy-fonts.ts` is rewritten with one
|
|
620
|
+
// `next/font/google` call per family the record's worked-out look or its
|
|
621
|
+
// brand fonts source that `LIBRARY_FONTS` does not hold. Every other build,
|
|
622
|
+
// a failed or refused read, and a record naming no such family leave the
|
|
623
|
+
// committed file as it is; a build never fails because the hub is down. A
|
|
624
|
+
// site whose `lib/deploy-fonts.ts` predates this release gets nothing.
|
|
625
|
+
|
|
626
|
+
const DEPLOY_FONTS_FILE = "lib/deploy-fonts.ts";
|
|
627
|
+
const DEPLOY_FONTS_READ_MS = 5_000;
|
|
628
|
+
const DEPLOY_IDENTIFIER = /^[A-Z][A-Za-z0-9_]*$/;
|
|
629
|
+
const DEPLOY_SLUG = /^[a-z0-9-]+$/;
|
|
630
|
+
/** The design record's top-level members the site reads; any other is removed before the strict parse, as the render's read does. */
|
|
631
|
+
const DEPLOY_DESIGN_MEMBERS = ["version", "from", "changes", "settings", "chrome", "brand"];
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* next/font's own Google data: family → { weights, subsets }. A path inside
|
|
635
|
+
* `next`, so a release that moves it leaves every deploy face unbuilt (the
|
|
636
|
+
* read is inside the writer's `try`), never a failed build.
|
|
637
|
+
*/
|
|
638
|
+
function googleFontData() {
|
|
639
|
+
return createRequire(import.meta.url)("next/dist/compiled/@next/font/dist/google/font-data.json");
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/** Whether this build reads its hub, by the render's rule (`hubConnected()`). */
|
|
643
|
+
function hubConnectedBuild() {
|
|
644
|
+
return sendsSpokeKey() || (apiBaseConfigured() && isSafeTransport(getApiBase()));
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/** The body's `design` parsed with #12470's schemas, as the render's read parses it, else `null`. */
|
|
648
|
+
function parsedDesign(design) {
|
|
649
|
+
if (typeof design !== "object" || design === null || Array.isArray(design)) return null;
|
|
650
|
+
const raw = design.record;
|
|
651
|
+
const record =
|
|
652
|
+
typeof raw === "object" && raw !== null && !Array.isArray(raw)
|
|
653
|
+
? Object.fromEntries(DEPLOY_DESIGN_MEMBERS.filter((key) => Object.hasOwn(raw, key)).map((key) => [key, raw[key]]))
|
|
654
|
+
: raw;
|
|
655
|
+
const parsedRecord = siteDesignSchema.safeParse(record);
|
|
656
|
+
const parsedSettings = designSettingsSchema.nullable().safeParse(design.settings ?? null);
|
|
657
|
+
return parsedRecord.success && parsedSettings.success
|
|
658
|
+
? { record: parsedRecord.data, settings: parsedSettings.data }
|
|
659
|
+
: null;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* The faces outside the library a parsed design names, each as next/font's
|
|
664
|
+
* own data key, sorted and deduplicated. A family next/font cannot build
|
|
665
|
+
* without a `weight` (no variable weight) or with no `latin` subset is
|
|
666
|
+
* skipped with one warning naming its role, never the family (S9, S12).
|
|
667
|
+
*/
|
|
668
|
+
function deployFamilies({ record, settings }, data, warn) {
|
|
669
|
+
const faces = settings ? compileDesignFonts(settings) : undefined;
|
|
670
|
+
const candidates = [
|
|
671
|
+
...["display", "body"].flatMap((role) => (faces?.[role] ? [{ role, stack: faces[role].family }] : [])),
|
|
672
|
+
...(record.brand?.fonts?.primary ? [{ role: "display", stack: record.brand.fonts.primary }] : []),
|
|
673
|
+
...(record.brand?.fonts?.secondary ? [{ role: "body", stack: record.brand.fonts.secondary }] : []),
|
|
674
|
+
];
|
|
675
|
+
const keys = new Map(Object.keys(data).map((key) => [key, key]));
|
|
676
|
+
const families = new Set();
|
|
677
|
+
for (const { role, stack } of candidates) {
|
|
678
|
+
if (fontTakesEffect(stack) !== "next-deploy") continue;
|
|
679
|
+
const family = unquoteFamily(stack.split(",")[0]);
|
|
680
|
+
const key = Object.hasOwn(data, family) ? keys.get(family) : undefined;
|
|
681
|
+
const entry = key === undefined ? undefined : data[key];
|
|
682
|
+
const buildable =
|
|
683
|
+
entry?.weights?.includes("variable") &&
|
|
684
|
+
entry?.subsets?.includes("latin") &&
|
|
685
|
+
DEPLOY_IDENTIFIER.test(key.replace(/ /g, "_")) &&
|
|
686
|
+
DEPLOY_SLUG.test(key.toLowerCase().replace(/ /g, "-"));
|
|
687
|
+
if (!buildable) {
|
|
688
|
+
warn(`[deploy-fonts] the ${role} font is not one next/font can build; it renders its fallback stack`);
|
|
689
|
+
continue;
|
|
690
|
+
}
|
|
691
|
+
families.add(key);
|
|
692
|
+
}
|
|
693
|
+
return [...families].sort();
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/** `lib/deploy-fonts.ts` with one `next/font/google` call per family; each name already passed its check. */
|
|
697
|
+
function renderDeployFonts(families) {
|
|
698
|
+
const faces = families.map((family, index) => ({
|
|
699
|
+
family,
|
|
700
|
+
identifier: family.replace(/ /g, "_"),
|
|
701
|
+
variable: `--font-deploy-${family.toLowerCase().replace(/ /g, "-")}`,
|
|
702
|
+
local: `face${index}`,
|
|
703
|
+
// A fixed alias, so a Google family named like a global (`Map`) never shadows it.
|
|
704
|
+
alias: `deployFace${index}`,
|
|
705
|
+
}));
|
|
706
|
+
const calls = faces.map(
|
|
707
|
+
(face) =>
|
|
708
|
+
`const ${face.local} = ${face.alias}({ subsets: ${JSON.stringify(["latin"])}, variable: ${JSON.stringify(face.variable)}, display: "swap" });`,
|
|
709
|
+
);
|
|
710
|
+
const entries = faces.map(
|
|
711
|
+
(face) => ` [${JSON.stringify(face.family)}, { variable: ${JSON.stringify(face.variable)}, className: ${face.local}.variable }],`,
|
|
712
|
+
);
|
|
713
|
+
// Its own value, so no line of this config starts with `import` after the
|
|
714
|
+
// real imports: create-ailk adds the docs module's import after the last one.
|
|
715
|
+
const importLine = `import { ${faces.map((face) => `${face.identifier} as ${face.alias}`).join(", ")} } from "next/font/google";`;
|
|
716
|
+
return `// deploy-fonts.ts — the faces outside the design library a hub design record
|
|
717
|
+
// names, built in at the site's next production build (#12473 D7).
|
|
718
|
+
//
|
|
719
|
+
// WRITTEN AT BUILD by \`next.config.mjs\` from the hub's design record. Never
|
|
720
|
+
// hand-edit; the committed default is the empty map.
|
|
721
|
+
|
|
722
|
+
${importLine}
|
|
723
|
+
|
|
724
|
+
${calls.join("\n")}
|
|
725
|
+
|
|
726
|
+
/** A built face: the CSS variable its family is read through, and the class that declares it. */
|
|
727
|
+
export const DEPLOY_FACES: ReadonlyMap<string, { variable: string; className: string }> = new Map([
|
|
728
|
+
${entries.join("\n")}
|
|
729
|
+
]);
|
|
730
|
+
`;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Rewrite `lib/deploy-fonts.ts` for the faces outside the library the hub's
|
|
735
|
+
* design record names (#12473 D7). Only at `PHASE_PRODUCTION_BUILD` on a
|
|
736
|
+
* hub-connected site whose file exists; never throws. `deps` replaces the
|
|
737
|
+
* file, the read, next/font's data and the log, for its test.
|
|
738
|
+
*/
|
|
739
|
+
export async function writeDeployFonts(phase, deps = {}) {
|
|
740
|
+
const {
|
|
741
|
+
file = join(process.cwd(), DEPLOY_FONTS_FILE),
|
|
742
|
+
connected = hubConnectedBuild,
|
|
743
|
+
read = () => siteConfig.get(),
|
|
744
|
+
fontData = googleFontData,
|
|
745
|
+
warn = (message) => console.warn(message),
|
|
746
|
+
timeoutMs = DEPLOY_FONTS_READ_MS,
|
|
747
|
+
} = deps;
|
|
748
|
+
if (phase !== PHASE_PRODUCTION_BUILD || !connected() || !existsSync(file)) return;
|
|
749
|
+
let timer;
|
|
750
|
+
try {
|
|
751
|
+
// S10, S14 — the writer stops waiting at the bound; the request itself
|
|
752
|
+
// cannot be aborted (api-client's `get` takes no signal).
|
|
753
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
754
|
+
timer = setTimeout(() => reject(new Error("timed out")), timeoutMs);
|
|
755
|
+
timer.unref?.();
|
|
756
|
+
});
|
|
757
|
+
const res = await Promise.race([Promise.resolve().then(read), timeout]);
|
|
758
|
+
if (!res?.ok) throw new Error("refused");
|
|
759
|
+
const design = res.body?.design;
|
|
760
|
+
if (design === undefined || design === null) return;
|
|
761
|
+
const parsed = parsedDesign(design);
|
|
762
|
+
if (parsed === null) {
|
|
763
|
+
warn("[deploy-fonts] the hub's design record is unreadable; building no face outside the library");
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
const families = deployFamilies(parsed, fontData(), warn);
|
|
767
|
+
if (families.length === 0) return;
|
|
768
|
+
// The file was checked before the read; check it again at the write, with
|
|
769
|
+
// no await between, so a file removed meanwhile is never created.
|
|
770
|
+
if (!existsSync(file)) return;
|
|
771
|
+
try {
|
|
772
|
+
writeFileSync(file, renderDeployFonts(families));
|
|
773
|
+
} catch {
|
|
774
|
+
warn("[deploy-fonts] lib/deploy-fonts.ts could not be written; building no face outside the library");
|
|
775
|
+
}
|
|
776
|
+
} catch {
|
|
777
|
+
warn("[deploy-fonts] the hub's design record could not be read; building no face outside the library");
|
|
778
|
+
} finally {
|
|
779
|
+
clearTimeout(timer);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
587
783
|
// #9889 D6 — `withBotId` adds BotID's two rewrites (the challenge script and
|
|
588
784
|
// its proxy) and one header rule on its own proxy prefix, which middleware.ts
|
|
589
785
|
// keeps out of its matcher. It is not gated on `AILK_BOOKING_BOT_CHECK`: this
|
|
@@ -591,7 +787,13 @@ const sentryBuildOptions = {
|
|
|
591
787
|
// answers nothing. It sits directly inside Sentry so the substrings
|
|
592
788
|
// (the MDX wrap and the next-intl wrap, quoted nowhere else) that create-ailk
|
|
593
789
|
// edits stay intact.
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
)
|
|
790
|
+
//
|
|
791
|
+
// #12473 D7 — a function of the phase, so a production build writes the
|
|
792
|
+
// deploy faces before Next reads the config's modules.
|
|
793
|
+
export default async function config(phase) {
|
|
794
|
+
await writeDeployFonts(phase);
|
|
795
|
+
return withSentryConfig(
|
|
796
|
+
withBotId(withBundleAnalyzer(withNextIntl(nextConfig))),
|
|
797
|
+
sentryBuildOptions,
|
|
798
|
+
);
|
|
799
|
+
}
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"test:watch": "jest --watch"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@fontsource-variable/figtree": "5.3.0",
|
|
19
|
+
"@fontsource-variable/newsreader": "5.3.0",
|
|
18
20
|
"@prisma/adapter-pg": "^7.8.0",
|
|
19
21
|
"@sentry/nextjs": "^10.58.0",
|
|
20
22
|
"@working-theory/account": "workspace:*",
|
|
@@ -33,8 +33,8 @@ import {
|
|
|
33
33
|
} from "./lib/pricing-page";
|
|
34
34
|
import { ApiError, forwardedCookieInit, unwrapApiResult } from "./lib/server-api";
|
|
35
35
|
import { SERVICES_PATH, SERVICES_ROUTE, toPublicServicesHref } from "./lib/services-path";
|
|
36
|
-
import { siteChrome } from "./lib/site-chrome";
|
|
37
36
|
import { readSiteContactEmail } from "./lib/site-contact-email";
|
|
37
|
+
import { BASE_SITE_LAYOUT } from "./lib/site-design";
|
|
38
38
|
import { siteLogomarkAsset, siteWordmarkAsset } from "./lib/site-logo";
|
|
39
39
|
import { readSession } from "./lib/topology.generated";
|
|
40
40
|
import { takeVisitorLimit } from "./src/lib/rate-limit";
|
|
@@ -84,7 +84,9 @@ export const site = {
|
|
|
84
84
|
SERVICES_PATH,
|
|
85
85
|
SERVICES_ROUTE,
|
|
86
86
|
toPublicServicesHref,
|
|
87
|
-
|
|
87
|
+
// #12477 D1 — the base look's knobs: only the home's floor, beneath
|
|
88
|
+
// `resolveHomeChrome`'s record `knobs`.
|
|
89
|
+
siteChrome: BASE_SITE_LAYOUT,
|
|
88
90
|
siteLogomarkAsset,
|
|
89
91
|
siteWordmarkAsset,
|
|
90
92
|
takeVisitorLimit,
|
|
@@ -17,32 +17,6 @@ siteIdentity:
|
|
|
17
17
|
sameAs: []
|
|
18
18
|
analytics:
|
|
19
19
|
vercelAnalytics: false
|
|
20
|
-
theme:
|
|
21
|
-
corners: square
|
|
22
|
-
eyebrowCase: sentence
|
|
23
|
-
placeholders: fill
|
|
24
|
-
checkmarks: plain
|
|
25
|
-
colors:
|
|
26
|
-
light:
|
|
27
|
-
bg: "#ffffff"
|
|
28
|
-
bgMuted: "#ffffff"
|
|
29
|
-
surface: "#ffffff"
|
|
30
|
-
border: "#000000"
|
|
31
|
-
text: "#000000"
|
|
32
|
-
textMuted: "#333333"
|
|
33
|
-
primary: "#000000"
|
|
34
|
-
primaryFg: "#ffffff"
|
|
35
|
-
accent: "#000000"
|
|
36
|
-
dark:
|
|
37
|
-
bg: "#000000"
|
|
38
|
-
bgMuted: "#000000"
|
|
39
|
-
surface: "#000000"
|
|
40
|
-
border: "#ffffff"
|
|
41
|
-
text: "#ffffff"
|
|
42
|
-
textMuted: "#cccccc"
|
|
43
|
-
primary: "#ffffff"
|
|
44
|
-
primaryFg: "#000000"
|
|
45
|
-
accent: "#ffffff"
|
|
46
20
|
---
|
|
47
21
|
|
|
48
22
|
<!--
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Source template: _base (the AI Launch Kit base scaffold)
|
|
2
|
+
# Design: standard
|
|
3
|
+
# Version: create-ailk {{CREATE_AILK_VERSION}}
|
|
4
|
+
name: Standard
|
|
5
|
+
version: 1
|
|
6
|
+
description: "The standard design — the black-on-white foundation any shape wears by default: full navigation, a multi-column footer, the document-scroll home."
|
|
7
|
+
colors:
|
|
8
|
+
bg: "#ffffff"
|
|
9
|
+
fg: "#000000"
|
|
10
|
+
surface: "#ffffff"
|
|
11
|
+
surface-secondary: "#ffffff"
|
|
12
|
+
border: "#000000"
|
|
13
|
+
text-muted: "#333333"
|
|
14
|
+
brand: "#000000"
|
|
15
|
+
fg-on-brand: "#ffffff"
|
|
16
|
+
accent: "#000000"
|
|
17
|
+
bg-dark: "#000000"
|
|
18
|
+
fg-dark: "#ffffff"
|
|
19
|
+
border-dark: "#ffffff"
|
|
20
|
+
brand-dark: "#ffffff"
|
|
21
|
+
text-muted-dark: "#cccccc"
|
|
22
|
+
surface-dark: "#000000"
|
|
23
|
+
surface-secondary-dark: "#000000"
|
|
24
|
+
fg-on-brand-dark: "#000000"
|
|
25
|
+
accent-dark: "#ffffff"
|
|
26
|
+
treatments:
|
|
27
|
+
corners: square
|
|
28
|
+
eyebrowCase: sentence
|
|
29
|
+
placeholders: fill
|
|
30
|
+
checkmarks: plain
|
|
31
|
+
layout:
|
|
32
|
+
nav: full
|
|
33
|
+
footer: columns
|
|
34
|
+
announcementBanner: false
|
|
35
|
+
home: default
|
|
36
|
+
copy:
|
|
37
|
+
density: standard
|
|
38
|
+
typography:
|
|
39
|
+
display:
|
|
40
|
+
fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif"
|
|
41
|
+
fontSize: "3.5rem"
|
|
42
|
+
fontWeight: 700
|
|
43
|
+
lineHeight: 1.1
|
|
44
|
+
letterSpacing: "normal"
|
|
45
|
+
heading-section:
|
|
46
|
+
fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif"
|
|
47
|
+
fontSize: "3rem"
|
|
48
|
+
fontWeight: 700
|
|
49
|
+
lineHeight: 1.1
|
|
50
|
+
letterSpacing: "normal"
|
|
51
|
+
heading-item:
|
|
52
|
+
fontSize: "2rem"
|
|
53
|
+
fontWeight: 700
|
|
54
|
+
lineHeight: 1.375
|
|
55
|
+
letterSpacing: "normal"
|
|
56
|
+
body:
|
|
57
|
+
fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif"
|
|
58
|
+
fontSize: "1.125rem"
|
|
59
|
+
fontWeight: 400
|
|
60
|
+
lineHeight: 1.5
|
|
61
|
+
eyebrow:
|
|
62
|
+
fontSize: "0.875rem"
|
|
63
|
+
fontWeight: 600
|
|
64
|
+
lineHeight: 1.4
|
|
65
|
+
letterSpacing: "0.05em"
|
|
66
|
+
rounded:
|
|
67
|
+
button: "0.5rem"
|
|
68
|
+
card: "0.75rem"
|
|
69
|
+
spacing:
|
|
70
|
+
section: "7rem"
|
|
71
|
+
section-mobile: "4rem"
|
|
72
|
+
card: "1.5rem"
|
|
73
|
+
grid: "1.5rem"
|
|
74
|
+
container: "1280px"
|
|
75
|
+
measure: "36rem"
|
package/templates/project.yaml
CHANGED
|
@@ -59,6 +59,20 @@ hard_floors:
|
|
|
59
59
|
- kind: pricing
|
|
60
60
|
- kind: stripe_live_mode
|
|
61
61
|
|
|
62
|
+
required_secrets:
|
|
63
|
+
# Settings a person must set by hand. The harness's setup steps list each
|
|
64
|
+
# one; an entry with no deployment field is shown as a GitHub Actions
|
|
65
|
+
# secret, so its description names where it must really be set.
|
|
66
|
+
- name: AILK_ADMIN_URL
|
|
67
|
+
description: >-
|
|
68
|
+
The Admin's https address. Set it on the hub's API and web deployments
|
|
69
|
+
(their environment variables), not only as a GitHub Actions secret.
|
|
70
|
+
Required when the Admin is not at admin.<FRONTEND_URL host>, for example
|
|
71
|
+
a hub at account.example.com: otherwise every invitation link names an
|
|
72
|
+
address that does not exist, and the Admin's Workforce page refuses to
|
|
73
|
+
send. Use the production Admin's address, never a preview
|
|
74
|
+
deployment's. A spoke has no Admin and leaves it unset.
|
|
75
|
+
|
|
62
76
|
artifacts:
|
|
63
77
|
# Where planning artifacts live in this repo. Default layout matches AILK.
|
|
64
78
|
decisions: docs/internal/decisions
|