create-claudecraft 1.0.0 → 2.0.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 +43 -178
- package/bin/cli.js +186 -1
- package/dist/answers.d.ts +269 -0
- package/dist/answers.js +215 -0
- package/dist/ink-prompts.d.ts +90 -12
- package/dist/ink-prompts.js +371 -330
- package/dist/lettering.d.ts +2 -0
- package/dist/lettering.js +28 -0
- package/lib/apps.mjs +141 -0
- package/lib/github.mjs +24 -0
- package/lib/init.mjs +153 -0
- package/lib/ports.mjs +56 -0
- package/lib/scaffold.mjs +218 -0
- package/lib/upgrade.mjs +164 -0
- package/package.json +39 -33
- package/templates/astro/.editorconfig +15 -0
- package/templates/astro/.env.example +2 -0
- package/templates/astro/.github/workflows/ci.yml +37 -0
- package/templates/astro/.github/workflows/deploy.yml +46 -0
- package/templates/astro/.nvmrc +1 -0
- package/templates/astro/.prettierignore +10 -0
- package/templates/astro/.prettierrc.json +7 -0
- package/templates/astro/.vscode/extensions.json +3 -0
- package/templates/astro/.vscode/settings.json +12 -0
- package/templates/astro/AGENTS.md +100 -0
- package/templates/astro/README.md +42 -0
- package/templates/astro/_CLAUDE.md +1 -0
- package/templates/astro/_claude/launch.json +13 -0
- package/templates/astro/_claude/settings.json +22 -0
- package/templates/astro/_codex/environments/environment.toml +20 -0
- package/templates/astro/_gitignore +31 -0
- package/templates/astro/_npmrc +8 -0
- package/templates/astro/_super.engineering/config.json +8 -0
- package/templates/astro/_zed/tasks.json +5 -0
- package/templates/astro/astro.config.mjs +111 -0
- package/templates/astro/docs/README.md +7 -0
- package/templates/astro/docs/decisions.md +3 -0
- package/templates/astro/docs/inbox.md +7 -0
- package/templates/astro/docs/kit/agent-apps.md +15 -0
- package/templates/astro/docs/kit/analytics.md +13 -0
- package/templates/astro/docs/kit/deploy.md +9 -0
- package/templates/astro/docs/kit/images.md +10 -0
- package/templates/astro/docs/kit/languages.md +8 -0
- package/templates/astro/docs/kit/local.md +16 -0
- package/templates/astro/docs/kit/seo.md +15 -0
- package/templates/astro/docs/kit/structure.md +40 -0
- package/templates/astro/docs/kit/upgrade.md +19 -0
- package/templates/astro/functions/_middleware.js +25 -0
- package/templates/astro/intent.md +40 -0
- package/templates/astro/package.json +46 -0
- package/templates/astro/public/_headers +17 -0
- package/templates/astro/public/_routes.json +5 -0
- package/templates/astro/public/apple-touch-icon.png +0 -0
- package/templates/astro/public/favicon-16.png +0 -0
- package/templates/astro/public/favicon-32.png +0 -0
- package/templates/astro/public/favicon.ico +0 -0
- package/templates/astro/public/favicon.svg +4 -0
- package/templates/astro/public/icon-192.png +0 -0
- package/templates/astro/public/icon-512.png +0 -0
- package/templates/astro/public/og-image.png +0 -0
- package/templates/astro/scripts/chrome.mjs +138 -0
- package/templates/astro/scripts/deploy.sh +69 -0
- package/templates/astro/scripts/generate-icons.mjs +73 -0
- package/templates/astro/scripts/generate-og.mjs +66 -0
- package/templates/astro/scripts/lint-copy.mjs +67 -0
- package/templates/astro/scripts/local-domain.mjs +115 -0
- package/templates/astro/scripts/markdown-pages.mjs +142 -0
- package/templates/astro/scripts/og-template.html +73 -0
- package/templates/astro/scripts/shared.mjs +33 -0
- package/templates/astro/scripts/verify-build.mjs +283 -0
- package/templates/astro/scripts/verify.mjs +19 -0
- package/templates/astro/site.config.mjs +85 -0
- package/templates/astro/src/components/Analytics.astro +49 -0
- package/templates/astro/src/components/Consent.astro +52 -0
- package/templates/astro/src/components/Counter.tsx +20 -0
- package/templates/astro/src/data/README.md +18 -0
- package/templates/astro/src/dev/styleguide.astro +43 -0
- package/templates/astro/src/env.d.ts +1 -0
- package/templates/astro/src/i18n/ar.json +29 -0
- package/templates/astro/src/i18n/de.json +29 -0
- package/templates/astro/src/i18n/en.json +29 -0
- package/templates/astro/src/i18n/es.json +29 -0
- package/templates/astro/src/i18n/fr.json +29 -0
- package/templates/astro/src/i18n/he.json +29 -0
- package/templates/astro/src/i18n/hi.json +29 -0
- package/templates/astro/src/i18n/index.ts +80 -0
- package/templates/astro/src/i18n/it.json +29 -0
- package/templates/astro/src/i18n/ja.json +29 -0
- package/templates/astro/src/i18n/ko.json +29 -0
- package/templates/astro/src/i18n/nl.json +29 -0
- package/templates/astro/src/i18n/pl.json +29 -0
- package/templates/astro/src/i18n/pt-br.json +29 -0
- package/templates/astro/src/i18n/ro.json +29 -0
- package/templates/astro/src/i18n/ru.json +29 -0
- package/templates/astro/src/i18n/sv.json +29 -0
- package/templates/astro/src/i18n/tr.json +29 -0
- package/templates/astro/src/i18n/uk.json +29 -0
- package/templates/astro/src/i18n/zh-cn.json +29 -0
- package/templates/astro/src/layouts/BaseLayout.astro +205 -0
- package/templates/astro/src/lib/cn.ts +7 -0
- package/templates/astro/src/lib/consent.ts +32 -0
- package/templates/astro/src/lib/seo.ts +18 -0
- package/templates/astro/src/lib/theme.ts +5 -0
- package/templates/astro/src/pages/404.astro +7 -0
- package/templates/astro/src/pages/[...locale]/404.astro +25 -0
- package/templates/astro/src/pages/[...locale]/about.astro +25 -0
- package/templates/astro/src/pages/[...locale]/index.astro +30 -0
- package/templates/astro/src/pages/[...locale]/privacy.astro +28 -0
- package/templates/astro/src/pages/robots.txt.ts +16 -0
- package/templates/astro/src/pages/site.webmanifest.ts +26 -0
- package/templates/astro/src/styles/global.css +163 -0
- package/templates/astro/t3.json +22 -0
- package/templates/astro/tsconfig.json +13 -0
- package/templates/astro/wrangler.toml +8 -0
- package/templates/react/.editorconfig +15 -0
- package/templates/react/.env.example +2 -0
- package/templates/react/.nvmrc +1 -0
- package/templates/react/.prettierignore +11 -0
- package/templates/react/.prettierrc.json +5 -0
- package/templates/react/.vscode/extensions.json +3 -0
- package/templates/react/.vscode/settings.json +4 -0
- package/templates/react/AGENTS.md +64 -0
- package/templates/react/README.md +31 -0
- package/templates/react/_CLAUDE.md +1 -0
- package/templates/react/_claude/launch.json +13 -0
- package/templates/react/_claude/settings.json +21 -0
- package/templates/react/_codex/environments/environment.toml +20 -0
- package/templates/react/_gitignore +17 -0
- package/templates/react/_npmrc +8 -0
- package/templates/react/_super.engineering/config.json +8 -0
- package/templates/react/_zed/tasks.json +5 -0
- package/templates/react/docs/decisions.md +3 -0
- package/templates/react/docs/inbox.md +7 -0
- package/templates/react/index.html +14 -0
- package/templates/react/package.json +47 -0
- package/templates/react/public/favicon.svg +5 -0
- package/templates/react/scripts/lint-copy.mjs +46 -0
- package/templates/react/scripts/lint-tokens.mjs +44 -0
- package/templates/react/scripts/local-domain.mjs +115 -0
- package/templates/react/scripts/verify.mjs +20 -0
- package/templates/react/site.config.mjs +23 -0
- package/templates/react/src/App.test.tsx +15 -0
- package/templates/react/src/App.tsx +21 -0
- package/templates/react/src/components/ErrorBoundary.tsx +42 -0
- package/templates/react/src/components/SkipLink.tsx +10 -0
- package/templates/react/src/config/site.ts +5 -0
- package/templates/react/src/lib/cn.ts +7 -0
- package/templates/react/src/main.tsx +13 -0
- package/templates/react/src/pages/HomePage.tsx +71 -0
- package/templates/react/src/pages/NotFoundPage.tsx +21 -0
- package/templates/react/src/styles/global.css +96 -0
- package/templates/react/src/test-setup.ts +1 -0
- package/templates/react/t3.json +22 -0
- package/templates/{base → react}/tsconfig.json +3 -3
- package/templates/react/vite.config.ts +26 -0
- package/templates/shared/_claude/hooks/design-lint.mjs +67 -0
- package/templates/shared/_claude/skills/design-quality/SKILL.md +113 -0
- package/templates/shared/_claude/skills/design-quality/references/composition-palette.md +87 -0
- package/templates/shared/_claude/skills/design-quality/references/copy-tells.md +49 -0
- package/templates/shared/_claude/skills/design-quality/references/visual-critic.md +75 -0
- package/templates/shared/design.md +148 -0
- package/templates/shared/intent.md +28 -0
- package/dist/constants.d.ts +0 -71
- package/dist/constants.js +0 -128
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -229
- package/dist/prompts.d.ts +0 -16
- package/dist/prompts.js +0 -434
- package/dist/scaffold.d.ts +0 -19
- package/dist/scaffold.js +0 -303
- package/dist/ui.d.ts +0 -27
- package/dist/ui.js +0 -254
- package/templates/app/App.tsx +0 -21
- package/templates/base/CLAUDE.md +0 -332
- package/templates/base/eslint.config.js +0 -28
- package/templates/base/index.html +0 -17
- package/templates/base/package.json +0 -43
- package/templates/base/postcss.config.js +0 -6
- package/templates/base/tailwind.config.js +0 -81
- package/templates/base/vite.config.ts +0 -16
- package/templates/commands/brainstorm.md +0 -6
- package/templates/commands/build.md +0 -41
- package/templates/commands/execute-plan.md +0 -6
- package/templates/commands/lint.md +0 -41
- package/templates/commands/ralph.md +0 -113
- package/templates/commands/typecheck.md +0 -44
- package/templates/commands/write-plan.md +0 -6
- package/templates/components/ErrorBoundary.tsx +0 -49
- package/templates/components/ui/Button.tsx +0 -60
- package/templates/components/ui/CodeBlock.tsx +0 -46
- package/templates/components/ui/CopyCommand.tsx +0 -38
- package/templates/components/ui/FilePreview.tsx +0 -46
- package/templates/components/ui/SkipLink.tsx +0 -7
- package/templates/components/ui/ThemeSelector.tsx +0 -41
- package/templates/components/ui/UICarousel.tsx +0 -309
- package/templates/context/ThemeContext.tsx +0 -61
- package/templates/homepage/HomePage.tsx +0 -534
- package/templates/homepage/NotFoundPage.tsx +0 -17
- package/templates/hooks/README.md +0 -82
- package/templates/hooks/check-branch.js +0 -27
- package/templates/hooks/typecheck-after-edit.js +0 -51
- package/templates/index.css +0 -67
- package/templates/lib/utils.ts +0 -9
- package/templates/main.tsx +0 -16
- package/templates/settings/MCP_SETUP.md +0 -76
- package/templates/settings/settings.json +0 -16
- package/templates/settings/settings.local.json +0 -37
- package/templates/skills/design/a11y-audit/SKILL.md +0 -173
- package/templates/skills/design/design-polish/SKILL.md +0 -75
- package/templates/skills/design/figma-to-code/SKILL.md +0 -157
- package/templates/skills/design/json-ld/SKILL.md +0 -125
- package/templates/skills/design/microcopy/SKILL.md +0 -197
- package/templates/skills/design/og-image/SKILL.md +0 -157
- package/templates/skills/design/ralph-wiggum-loops/SKILL.md +0 -299
- package/templates/skills/design/react-best-practices/SKILL.md +0 -106
- package/templates/skills/design/react-best-practices/references/react-performance-guidelines.md +0 -143
- package/templates/skills/design/seo-review/SKILL.md +0 -96
- package/templates/skills/design/sitemap-generator/SKILL.md +0 -66
- package/templates/skills/design/testing-patterns/SKILL.md +0 -276
- package/templates/skills/design/ui-skills/SKILL.md +0 -85
- package/templates/skills/design/visual-iteration/SKILL.md +0 -88
- package/templates/skills/workflow/brainstorming/SKILL.md +0 -54
- package/templates/skills/workflow/dispatching-parallel-agents/SKILL.md +0 -180
- package/templates/skills/workflow/executing-plans/SKILL.md +0 -76
- package/templates/skills/workflow/finishing-a-development-branch/SKILL.md +0 -200
- package/templates/skills/workflow/receiving-code-review/SKILL.md +0 -213
- package/templates/skills/workflow/requesting-code-review/SKILL.md +0 -105
- package/templates/skills/workflow/requesting-code-review/code-reviewer.md +0 -146
- package/templates/skills/workflow/subagent-driven-development/SKILL.md +0 -240
- package/templates/skills/workflow/subagent-driven-development/code-quality-reviewer-prompt.md +0 -20
- package/templates/skills/workflow/subagent-driven-development/implementer-prompt.md +0 -78
- package/templates/skills/workflow/subagent-driven-development/spec-reviewer-prompt.md +0 -61
- package/templates/skills/workflow/systematic-debugging/CREATION-LOG.md +0 -119
- package/templates/skills/workflow/systematic-debugging/SKILL.md +0 -296
- package/templates/skills/workflow/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/templates/skills/workflow/systematic-debugging/condition-based-waiting.md +0 -115
- package/templates/skills/workflow/systematic-debugging/defense-in-depth.md +0 -122
- package/templates/skills/workflow/systematic-debugging/find-polluter.sh +0 -63
- package/templates/skills/workflow/systematic-debugging/root-cause-tracing.md +0 -169
- package/templates/skills/workflow/systematic-debugging/test-academic.md +0 -14
- package/templates/skills/workflow/systematic-debugging/test-pressure-1.md +0 -58
- package/templates/skills/workflow/systematic-debugging/test-pressure-2.md +0 -68
- package/templates/skills/workflow/systematic-debugging/test-pressure-3.md +0 -69
- package/templates/skills/workflow/test-driven-development/SKILL.md +0 -371
- package/templates/skills/workflow/test-driven-development/testing-anti-patterns.md +0 -299
- package/templates/skills/workflow/using-git-worktrees/SKILL.md +0 -217
- package/templates/skills/workflow/using-superpowers/SKILL.md +0 -87
- package/templates/skills/workflow/verification-before-completion/SKILL.md +0 -139
- package/templates/skills/workflow/writing-plans/SKILL.md +0 -116
- package/templates/skills/workflow/writing-skills/SKILL.md +0 -655
- package/templates/skills/workflow/writing-skills/anthropic-best-practices.md +0 -1150
- package/templates/skills/workflow/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/templates/skills/workflow/writing-skills/graphviz-conventions.dot +0 -172
- package/templates/skills/workflow/writing-skills/persuasion-principles.md +0 -187
- package/templates/skills/workflow/writing-skills/render-graphs.js +0 -168
- package/templates/skills/workflow/writing-skills/testing-skills-with-subagents.md +0 -384
- package/templates/types/index.ts +0 -17
- /package/templates/{vite-env.d.ts → react/src/vite-env.d.ts} +0 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// Post-build assertions for the SEO/AEO, i18n and share/unfurl contract.
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { readFile, readdir } from 'node:fs/promises';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import {
|
|
7
|
+
analytics,
|
|
8
|
+
darkMode,
|
|
9
|
+
defaultLocale,
|
|
10
|
+
locales,
|
|
11
|
+
publisher,
|
|
12
|
+
siteName,
|
|
13
|
+
siteUrl,
|
|
14
|
+
tracked,
|
|
15
|
+
} from '../site.config.mjs';
|
|
16
|
+
import { catalog, dist, distFiles, isNoindex, localeOf } from './shared.mjs';
|
|
17
|
+
|
|
18
|
+
const site = new URL(siteUrl);
|
|
19
|
+
const translated = locales.length > 1;
|
|
20
|
+
const meta = Object.fromEntries(locales.map((code) => [code, catalog(code).meta]));
|
|
21
|
+
|
|
22
|
+
const read = (rel) => readFile(join(dist, rel), 'utf8');
|
|
23
|
+
const exists = (rel) => existsSync(join(dist, rel));
|
|
24
|
+
|
|
25
|
+
/** Attributes of every <name …> tag, in any order. */
|
|
26
|
+
const tags = (source, name) =>
|
|
27
|
+
[...source.matchAll(new RegExp(`<${name}\\b([^>]*)>`, 'g'))].map(([, attrs]) =>
|
|
28
|
+
Object.fromEntries([...attrs.matchAll(/([\w:-]+)="([^"]*)"/g)].map(([, key, value]) => [key, value])),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
function assertLang(rel, html, code) {
|
|
32
|
+
const { lang, dir } = tags(html, 'html')[0] ?? {};
|
|
33
|
+
assert.equal(lang, meta[code].hreflang, `${rel}: <html lang> is ${code}'s hreflang`);
|
|
34
|
+
assert.equal(dir, meta[code].dir, `${rel}: <html dir>`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// _headers: exactly one /* block (a second silently wins on Cloudflare Pages)
|
|
38
|
+
const headers = await readFile(new URL('../public/_headers', import.meta.url), 'utf8');
|
|
39
|
+
const pathLines = headers
|
|
40
|
+
.split(/\r?\n/)
|
|
41
|
+
.map((l) => l.trim())
|
|
42
|
+
.filter((l) => l.startsWith('/'));
|
|
43
|
+
assert.equal(pathLines.filter((l) => l === '/*').length, 1, '_headers must have exactly one /* block');
|
|
44
|
+
|
|
45
|
+
assert.ok(exists('index.html'), 'home html');
|
|
46
|
+
assert.ok(exists('index.md'), 'home markdown');
|
|
47
|
+
assert.ok(exists('llms.txt'), 'llms.txt');
|
|
48
|
+
assert.ok(exists('llms-full.txt'), 'llms-full.txt');
|
|
49
|
+
assert.ok(exists('robots.txt'), 'robots.txt');
|
|
50
|
+
assert.ok(exists('sitemap-index.xml'), 'sitemap-index.xml');
|
|
51
|
+
assert.ok(exists('_headers'), '_headers copied into dist');
|
|
52
|
+
// Pages run through functions/_middleware.js (markdown on request); assets and the twins skip it.
|
|
53
|
+
const routes = JSON.parse(await read('_routes.json'));
|
|
54
|
+
assert.deepEqual(routes.include, ['/*'], '_routes.json sends pages through the markdown function');
|
|
55
|
+
assert.ok(
|
|
56
|
+
routes.exclude.includes('/_astro/*') && routes.exclude.includes('/*.md'),
|
|
57
|
+
'_routes.json skips assets',
|
|
58
|
+
);
|
|
59
|
+
assert.ok(existsSync(new URL('../functions/_middleware.js', import.meta.url)), 'functions/_middleware.js');
|
|
60
|
+
assert.ok(exists('favicon.svg'), 'favicon.svg');
|
|
61
|
+
assert.ok(exists('apple-touch-icon.png'), 'apple-touch-icon');
|
|
62
|
+
assert.ok(exists('icon-192.png') && exists('icon-512.png'), 'PWA icons');
|
|
63
|
+
|
|
64
|
+
assert.ok(exists('site.webmanifest'), 'site.webmanifest');
|
|
65
|
+
|
|
66
|
+
// Appearance follows darkMode in site.config.mjs.
|
|
67
|
+
const homeHtml = await read('index.html');
|
|
68
|
+
assert.equal(
|
|
69
|
+
tags(homeHtml, 'html')[0]?.['data-theme'],
|
|
70
|
+
darkMode ? 'auto' : undefined,
|
|
71
|
+
'html data-theme matches darkMode',
|
|
72
|
+
);
|
|
73
|
+
assert.equal(
|
|
74
|
+
tags(homeHtml, 'meta').find((m) => m.name === 'color-scheme')?.content,
|
|
75
|
+
darkMode ? 'light dark' : 'light',
|
|
76
|
+
'color-scheme meta matches darkMode',
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const robots = await read('robots.txt');
|
|
80
|
+
assert.match(robots, /Content-Signal:/);
|
|
81
|
+
assert.match(robots, new RegExp(`Sitemap:\\s*${site.origin.replace(/\./g, '\\.')}/sitemap`));
|
|
82
|
+
|
|
83
|
+
// Cloudflare Pages serves the nearest 404.html up the tree; without /404.html it falls back to SPA mode.
|
|
84
|
+
for (const code of locales) {
|
|
85
|
+
const rel = code === defaultLocale ? '404.html' : `${code}/404.html`;
|
|
86
|
+
assert.ok(exists(rel), `${rel} exists`);
|
|
87
|
+
const html = await read(rel);
|
|
88
|
+
assert.ok(isNoindex(html), `${rel}: noindex`);
|
|
89
|
+
assertLang(rel, html, code);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Built pages by URL. */
|
|
93
|
+
const pages = new Map();
|
|
94
|
+
for (const rel of await distFiles('index.html')) {
|
|
95
|
+
const html = await read(rel);
|
|
96
|
+
pages.set(new URL(rel.replace(/index\.html$/, ''), site).href, {
|
|
97
|
+
rel,
|
|
98
|
+
html,
|
|
99
|
+
locale: localeOf(rel),
|
|
100
|
+
noindex: isNoindex(html),
|
|
101
|
+
links: tags(html, 'link'),
|
|
102
|
+
metas: tags(html, 'meta'),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const indexable = [...pages].filter(([, page]) => !page.noindex);
|
|
106
|
+
|
|
107
|
+
// Analytics load only for the IDs in site.config.mjs, and a page that loads any asks about cookies.
|
|
108
|
+
for (const [, { rel, html }] of pages) {
|
|
109
|
+
assert.equal(
|
|
110
|
+
html.includes('googletagmanager.com'),
|
|
111
|
+
Boolean(analytics.googleAnalytics),
|
|
112
|
+
`${rel}: Google tag`,
|
|
113
|
+
);
|
|
114
|
+
assert.equal(html.includes('clarity.ms'), Boolean(analytics.clarity), `${rel}: Clarity tag`);
|
|
115
|
+
assert.equal(html.includes('id="consent"'), tracked, `${rel}: the cookie question`);
|
|
116
|
+
assert.equal(html.includes('data-consent="open"'), tracked, `${rel}: the button that asks again`);
|
|
117
|
+
}
|
|
118
|
+
// The cookie question links to /privacy/, which exists in every language only while an ID is set.
|
|
119
|
+
for (const code of locales) {
|
|
120
|
+
const rel = `${code === defaultLocale ? '' : `${code}/`}privacy/index.html`;
|
|
121
|
+
assert.equal(exists(rel), tracked, `${rel}: built only with an analytics ID`);
|
|
122
|
+
}
|
|
123
|
+
const hreflangLinks = (page) => page.links.filter((l) => l.rel === 'alternate' && l.hreflang);
|
|
124
|
+
|
|
125
|
+
const sitemap = new Map();
|
|
126
|
+
for (const file of (await readdir(dist)).filter((name) => /^sitemap-\d+\.xml$/.test(name))) {
|
|
127
|
+
for (const [, body] of (await read(file)).matchAll(/<url>([\s\S]*?)<\/url>/g)) {
|
|
128
|
+
sitemap.set(body.match(/<loc>([^<]*)<\/loc>/)[1], tags(body, 'xhtml:link'));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (const url of sitemap.keys()) {
|
|
132
|
+
assert.ok(
|
|
133
|
+
pages.get(url) && !pages.get(url).noindex,
|
|
134
|
+
`sitemap lists ${url}, which is not an indexable page`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const llms = await read('llms.txt');
|
|
139
|
+
for (const [url, page] of pages) {
|
|
140
|
+
if (page.noindex) assert.ok(!llms.includes(`](${url})`), `${page.rel}: noindex, so not in llms.txt`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
for (const [url, page] of indexable) {
|
|
144
|
+
const { rel, html, locale, links, metas } = page;
|
|
145
|
+
const { hreflang, ogLocale } = meta[locale];
|
|
146
|
+
assertLang(rel, html, locale);
|
|
147
|
+
assert.match(html, /<main\b/, `${rel}: <main>`);
|
|
148
|
+
assert.equal((html.match(/<h1\b/g) ?? []).length, 1, `${rel}: exactly one <h1>`);
|
|
149
|
+
assert.deepEqual(
|
|
150
|
+
links.filter((l) => l.rel === 'canonical').map((l) => l.href),
|
|
151
|
+
[url],
|
|
152
|
+
`${rel}: canonical is itself`,
|
|
153
|
+
);
|
|
154
|
+
const content = (property) => metas.filter((m) => m.property === property).map((m) => m.content);
|
|
155
|
+
assert.ok(content('og:image')[0]?.startsWith(`${site.origin}/`), `${rel}: absolute og:image`);
|
|
156
|
+
assert.ok(
|
|
157
|
+
exists(decodeURIComponent(new URL(content('og:image')[0]).pathname.slice(1))),
|
|
158
|
+
`${rel}: og:image ${content('og:image')[0]} is not in dist/`,
|
|
159
|
+
);
|
|
160
|
+
assert.deepEqual(content('og:locale'), [ogLocale], `${rel}: og:locale`);
|
|
161
|
+
assert.ok(
|
|
162
|
+
links.some((l) => l.rel === 'manifest' && l.href === '/site.webmanifest'),
|
|
163
|
+
`${rel}: web manifest link`,
|
|
164
|
+
);
|
|
165
|
+
assert.ok(
|
|
166
|
+
metas.some((m) => m.name === 'theme-color'),
|
|
167
|
+
`${rel}: theme-color`,
|
|
168
|
+
);
|
|
169
|
+
assert.match(html, /viewport-fit=cover/, `${rel}: viewport-fit`);
|
|
170
|
+
assert.ok(sitemap.has(url), `${rel}: in the sitemap`);
|
|
171
|
+
assert.ok(llms.includes(`](${url})`), `${rel}: listed in llms.txt`);
|
|
172
|
+
assert.ok(exists(rel.replace(/index\.html$/, 'index.md')), `${rel}: markdown twin`);
|
|
173
|
+
|
|
174
|
+
const scripts = [...html.matchAll(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/g)];
|
|
175
|
+
assert.equal(scripts.length, 1, `${rel}: exactly one JSON-LD`);
|
|
176
|
+
const ld = JSON.parse(scripts[0][1]);
|
|
177
|
+
assert.equal(ld['@context'], 'https://schema.org');
|
|
178
|
+
assert.ok(Array.isArray(ld['@graph']), `${rel}: @graph`);
|
|
179
|
+
const node = (type) => ld['@graph'].find((n) => n['@type'] === type);
|
|
180
|
+
const webPage = ld['@graph'].find((n) => n['@id'] === `${url}#webpage`);
|
|
181
|
+
assert.ok(webPage, `${rel}: JSON-LD page node is ${url}#webpage`);
|
|
182
|
+
assert.equal(node('WebSite').name, siteName, `${rel}: JSON-LD WebSite name is the site name`);
|
|
183
|
+
assert.equal(
|
|
184
|
+
node('Organization').name,
|
|
185
|
+
publisher.name || siteName,
|
|
186
|
+
`${rel}: JSON-LD Organization is the publisher`,
|
|
187
|
+
);
|
|
188
|
+
assert.equal(webPage.inLanguage, hreflang, `${rel}: page inLanguage`);
|
|
189
|
+
assert.deepEqual(
|
|
190
|
+
node('WebSite').inLanguage,
|
|
191
|
+
translated ? locales.map((code) => meta[code].hreflang) : hreflang,
|
|
192
|
+
`${rel}: WebSite inLanguage lists every locale`,
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const alternates = hreflangLinks(page);
|
|
196
|
+
if (!translated) {
|
|
197
|
+
assert.equal(alternates.length, 0, `${rel}: one locale, so no hreflang links`);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
assert.deepEqual(
|
|
201
|
+
alternates.map((l) => l.hreflang).sort(),
|
|
202
|
+
[...locales.map((code) => meta[code].hreflang), 'x-default'].sort(),
|
|
203
|
+
`${rel}: hreflang for every locale plus x-default`,
|
|
204
|
+
);
|
|
205
|
+
const href = Object.fromEntries(alternates.map((l) => [l.hreflang, l.href]));
|
|
206
|
+
const defaultUrl = href[meta[defaultLocale].hreflang];
|
|
207
|
+
assert.equal(href[hreflang], url, `${rel}: hreflang references itself`);
|
|
208
|
+
assert.equal(href['x-default'], defaultUrl, `${rel}: x-default is the default locale`);
|
|
209
|
+
for (const [lang, target] of Object.entries(href)) {
|
|
210
|
+
assert.ok(target.startsWith(`${site.origin}/`), `${rel}: hreflang ${lang} is absolute on ${site.origin}`);
|
|
211
|
+
const other = pages.get(target);
|
|
212
|
+
assert.ok(other && !other.noindex, `${rel}: hreflang ${lang} → ${target} is an indexable page`);
|
|
213
|
+
const back = hreflangLinks(other).find((l) => l.hreflang === hreflang);
|
|
214
|
+
assert.equal(back?.href, url, `${rel}: ${target} links back (reciprocal hreflang)`);
|
|
215
|
+
}
|
|
216
|
+
const others = locales.filter((code) => code !== locale);
|
|
217
|
+
assert.deepEqual(
|
|
218
|
+
content('og:locale:alternate').sort(),
|
|
219
|
+
others.map((code) => meta[code].ogLocale).sort(),
|
|
220
|
+
`${rel}: og:locale:alternate`,
|
|
221
|
+
);
|
|
222
|
+
assert.deepEqual(
|
|
223
|
+
Object.fromEntries(sitemap.get(url).map((l) => [l.hreflang, l.href])),
|
|
224
|
+
href,
|
|
225
|
+
`${rel}: sitemap alternates match the page`,
|
|
226
|
+
);
|
|
227
|
+
if (locale === defaultLocale) {
|
|
228
|
+
assert.deepEqual(
|
|
229
|
+
webPage.workTranslation?.map((n) => n['@id']).sort(),
|
|
230
|
+
others.map((code) => `${href[meta[code].hreflang]}#webpage`).sort(),
|
|
231
|
+
`${rel}: JSON-LD workTranslation`,
|
|
232
|
+
);
|
|
233
|
+
} else {
|
|
234
|
+
assert.equal(
|
|
235
|
+
webPage.translationOfWork?.['@id'],
|
|
236
|
+
`${defaultUrl}#webpage`,
|
|
237
|
+
`${rel}: JSON-LD translationOfWork`,
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
assert.ok(indexable.length >= 1, 'at least one public page');
|
|
243
|
+
|
|
244
|
+
// Each public page has its own title and description within its language.
|
|
245
|
+
for (const [what, text] of [
|
|
246
|
+
['title', (page) => page.html.match(/<title>([^<]*)<\/title>/)?.[1]],
|
|
247
|
+
// A description may hold '>' (a name like <Lab>), where tags() stops: read up to the closing quote.
|
|
248
|
+
['description', (page) => page.html.match(/<meta name="description" content="([^"]*)"/)?.[1]],
|
|
249
|
+
]) {
|
|
250
|
+
const seen = new Map();
|
|
251
|
+
for (const [, page] of indexable) {
|
|
252
|
+
const key = `${page.locale} ${text(page)}`;
|
|
253
|
+
assert.ok(text(page), `${page.rel}: ${what}`);
|
|
254
|
+
assert.ok(!seen.has(key), `${page.rel}: same ${what} as ${seen.get(key)}`);
|
|
255
|
+
seen.set(key, page.rel);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Every internal link on a public page lands on something that was built.
|
|
260
|
+
for (const [, page] of indexable) {
|
|
261
|
+
for (const { href } of tags(page.html, 'a')) {
|
|
262
|
+
if (!href?.startsWith('/') || href.startsWith('//')) continue;
|
|
263
|
+
const path = decodeURI(href.split(/[?#]/)[0]);
|
|
264
|
+
assert.ok(
|
|
265
|
+
exists(path.endsWith('/') ? `${path}index.html` : path),
|
|
266
|
+
`${page.rel}: links to ${href}, which was not built`,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const wrangler = await readFile(new URL('../wrangler.toml', import.meta.url), 'utf8');
|
|
272
|
+
assert.match(wrangler, /pages_build_output_dir\s*=\s*"dist"/, 'wrangler Pages dist/');
|
|
273
|
+
// Ignore comments — the stub documents that we do *not* use the SSR adapter.
|
|
274
|
+
const wranglerCode = wrangler
|
|
275
|
+
.split('\n')
|
|
276
|
+
.filter((l) => !/^\s*#/.test(l))
|
|
277
|
+
.join('\n');
|
|
278
|
+
assert.ok(!/@astrojs\/cloudflare/.test(wranglerCode), 'no SSR adapter binding in wrangler');
|
|
279
|
+
assert.ok(!/^\s*adapter\s*=/m.test(wranglerCode), 'no adapter key in wrangler');
|
|
280
|
+
|
|
281
|
+
console.log(
|
|
282
|
+
`verify-build: ok (${indexable.length} public page(s) in ${locales.length} language(s); hreflang, sitemap, llms.txt, links, 404s, CF/OG/icons)`,
|
|
283
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// npm run verify: the gate before "done". Formatting, then the whole build with its checks.
|
|
3
|
+
// A pass prints nothing. A failure prints the first failing step's output, without colors.
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
5
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
6
|
+
|
|
7
|
+
const env = { ...process.env, NO_COLOR: '1', FORCE_COLOR: '0', CI: '1' };
|
|
8
|
+
|
|
9
|
+
for (const script of ['format:check', 'build']) {
|
|
10
|
+
const run = spawnSync('npm', ['run', '--silent', script], {
|
|
11
|
+
env,
|
|
12
|
+
encoding: 'utf8',
|
|
13
|
+
maxBuffer: 1 << 28,
|
|
14
|
+
shell: process.platform === 'win32',
|
|
15
|
+
});
|
|
16
|
+
if (run.status === 0) continue;
|
|
17
|
+
process.stderr.write(stripVTControlCharacters(`npm run ${script} failed:\n${run.stdout}${run.stderr}`));
|
|
18
|
+
process.exit(run.status ?? 1);
|
|
19
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { loadEnvFile } from 'node:process';
|
|
4
|
+
|
|
5
|
+
// Astro evaluates config before loading .env. Read the local file explicitly.
|
|
6
|
+
const envFile = new URL('.env', import.meta.url);
|
|
7
|
+
if (existsSync(envFile)) loadEnvFile(envFile);
|
|
8
|
+
|
|
9
|
+
// prettier-ignore
|
|
10
|
+
const url = new URL(process.env.SITE_URL || '{{SITE_URL}}');
|
|
11
|
+
if (
|
|
12
|
+
!['http:', 'https:'].includes(url.protocol) ||
|
|
13
|
+
url.pathname !== '/' ||
|
|
14
|
+
url.search ||
|
|
15
|
+
url.hash ||
|
|
16
|
+
url.username ||
|
|
17
|
+
url.password
|
|
18
|
+
) {
|
|
19
|
+
throw new Error('SITE_URL must be a public HTTP(S) origin without a path, credentials, query or fragment.');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Canonical origin (trailing slash). Override with SITE_URL in .env. */
|
|
23
|
+
export const siteUrl = url.href;
|
|
24
|
+
|
|
25
|
+
/** Human-facing site name. */
|
|
26
|
+
// prettier-ignore
|
|
27
|
+
export const siteName = process.env.SITE_NAME || '{{SITE_NAME}}';
|
|
28
|
+
|
|
29
|
+
/** The claudecraft kit version this site was made with, or last upgraded to. */
|
|
30
|
+
// (Read from the working directory: in a build this module no longer sits in the site's root.)
|
|
31
|
+
export const kit = existsSync('claudecraft.json')
|
|
32
|
+
? JSON.parse(readFileSync('claudecraft.json', 'utf8')).kit
|
|
33
|
+
: '';
|
|
34
|
+
|
|
35
|
+
/** Dev server port, fixed per project so the local URL never changes. PORT=<n> npm run dev overrides it. */
|
|
36
|
+
export const devPort = {{DEV_PORT}};
|
|
37
|
+
|
|
38
|
+
/** Dark appearance that follows each visitor's system setting; false is light only. Colors: global.css. */
|
|
39
|
+
export const darkMode = {{DARK_MODE}};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Locale codes, default first. Each has src/i18n/<code>.json. The default is unprefixed (/),
|
|
43
|
+
* the rest live under /<code>/, and every page exists in every locale.
|
|
44
|
+
* (prettier-ignore: the scaffold writes this array on one line, however many locales.)
|
|
45
|
+
*/
|
|
46
|
+
// prettier-ignore
|
|
47
|
+
export const locales = '{{LOCALES}}';
|
|
48
|
+
|
|
49
|
+
export const defaultLocale = '{{DEFAULT_LOCALE}}';
|
|
50
|
+
|
|
51
|
+
/** Content Signals (contentsignals.org) for robots.txt. Flip values here, not in the host. */
|
|
52
|
+
export const contentSignal = 'search=yes, ai-input=yes, ai-train=yes';
|
|
53
|
+
|
|
54
|
+
/** ISO date the site first shipped. */
|
|
55
|
+
export const published = '{{PUBLISHED}}';
|
|
56
|
+
|
|
57
|
+
/** ISO date of the last commit that touched this folder (JSON-LD dateModified); `published` without one. */
|
|
58
|
+
const lastCommit = () => {
|
|
59
|
+
try {
|
|
60
|
+
const options = { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] };
|
|
61
|
+
return execFileSync('git', ['log', '-1', '--format=%cs', '--', '.'], options).trim();
|
|
62
|
+
} catch {
|
|
63
|
+
return '';
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export const modified = lastCommit() || published;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Analytics IDs; an empty one loads nothing. googleAnalytics is the G-… measurement ID, clarity the
|
|
70
|
+
* Microsoft Clarity project ID (clarity.microsoft.com → Settings → Setup). With either set, every
|
|
71
|
+
* page asks once about cookies (src/components/Consent.astro), both run without cookies until the
|
|
72
|
+
* visitor says yes, and /privacy/ is built: deploy refuses until its text is written. Cloudflare Web Analytics sets no cookies and needs no code: switch it on
|
|
73
|
+
* for the Pages project in the Cloudflare dashboard.
|
|
74
|
+
*/
|
|
75
|
+
export const analytics = { googleAnalytics: '', clarity: '' };
|
|
76
|
+
|
|
77
|
+
/** True with any analytics ID set: pages then ask about cookies and /privacy/ is built. */
|
|
78
|
+
export const tracked = Object.values(analytics).some(Boolean);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Who publishes the site: the Organization in JSON-LD. Leave name empty when the site is its own
|
|
82
|
+
* publisher. For a site run by a studio or company, set that name and its URL; sameAs lists its
|
|
83
|
+
* profile URLs (GitHub, X, LinkedIn).
|
|
84
|
+
*/
|
|
85
|
+
export const publisher = { name: '', url: '', sameAs: [] };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Google Analytics and Microsoft Clarity, for the IDs set in `analytics` (site.config.mjs).
|
|
3
|
+
// Both start without cookies; an earlier yes (src/lib/consent.ts) grants them at once.
|
|
4
|
+
// Goes in <head>. Consent.astro asks the question.
|
|
5
|
+
import { CONSENT_KEY } from '@/lib/consent';
|
|
6
|
+
import { analytics } from '../../site.config.mjs';
|
|
7
|
+
|
|
8
|
+
const { googleAnalytics } = analytics;
|
|
9
|
+
const clarity = analytics.clarity && `https://www.clarity.ms/tag/${analytics.clarity}`;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
{(googleAnalytics || clarity) && <script
|
|
13
|
+
is:inline
|
|
14
|
+
define:vars={{ googleAnalytics, clarity, key: CONSENT_KEY }}
|
|
15
|
+
>
|
|
16
|
+
let state = 'denied';
|
|
17
|
+
try {
|
|
18
|
+
if (localStorage.getItem(key) === 'yes') state = 'granted';
|
|
19
|
+
} catch {}
|
|
20
|
+
if (googleAnalytics) {
|
|
21
|
+
window.dataLayer = window.dataLayer || [];
|
|
22
|
+
window.gtag = function () {
|
|
23
|
+
window.dataLayer.push(arguments);
|
|
24
|
+
};
|
|
25
|
+
window.gtag('consent', 'default', {
|
|
26
|
+
ad_storage: 'denied',
|
|
27
|
+
ad_user_data: 'denied',
|
|
28
|
+
ad_personalization: 'denied',
|
|
29
|
+
analytics_storage: state,
|
|
30
|
+
});
|
|
31
|
+
window.gtag('js', new Date());
|
|
32
|
+
window.gtag('config', googleAnalytics);
|
|
33
|
+
}
|
|
34
|
+
if (clarity) {
|
|
35
|
+
window.clarity =
|
|
36
|
+
window.clarity ||
|
|
37
|
+
function () {
|
|
38
|
+
(window.clarity.q = window.clarity.q || []).push(arguments);
|
|
39
|
+
};
|
|
40
|
+
const tag = document.createElement('script');
|
|
41
|
+
tag.async = true;
|
|
42
|
+
tag.src = clarity;
|
|
43
|
+
document.head.append(tag);
|
|
44
|
+
window.clarity('consentv2', { ad_Storage: 'denied', analytics_Storage: state });
|
|
45
|
+
}
|
|
46
|
+
</script>}
|
|
47
|
+
{googleAnalytics && (
|
|
48
|
+
<script is:inline async src={`https://www.googletagmanager.com/gtag/js?id=${googleAnalytics}`} />
|
|
49
|
+
)}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The cookie question, once per browser: shown until the visitor answers, and again from the
|
|
3
|
+
// footer's button (data-consent="open"). Refusing takes the same one press as allowing.
|
|
4
|
+
import { copy, localePath } from '@/i18n';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
locale: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { locale } = Astro.props;
|
|
11
|
+
const ui = copy(locale);
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<section
|
|
15
|
+
id="consent"
|
|
16
|
+
hidden
|
|
17
|
+
aria-label={ui.consentOpen}
|
|
18
|
+
class="fixed inset-x-4 bottom-[max(1rem,env(safe-area-inset-bottom))] z-40 mx-auto max-w-sm border border-[var(--color-rule)] bg-[var(--color-paper)] p-4 text-sm sm:start-auto sm:mx-0"
|
|
19
|
+
>
|
|
20
|
+
<p>
|
|
21
|
+
{ui.consentBody} <a href={localePath(locale, '/privacy/')}>{ui.privacy}</a>
|
|
22
|
+
</p>
|
|
23
|
+
<div class="mt-3 flex gap-3">
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
data-consent="yes"
|
|
27
|
+
class="min-h-11 flex-1 cursor-pointer border border-[var(--color-ink)] px-3"
|
|
28
|
+
>
|
|
29
|
+
{ui.consentYes}
|
|
30
|
+
</button>
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
data-consent="no"
|
|
34
|
+
class="min-h-11 flex-1 cursor-pointer border border-[var(--color-ink)] px-3"
|
|
35
|
+
>
|
|
36
|
+
{ui.consentNo}
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
39
|
+
</section>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import { answer, decide, type Answer } from '@/lib/consent';
|
|
43
|
+
|
|
44
|
+
const box = document.getElementById('consent');
|
|
45
|
+
if (box && !answer()) box.hidden = false;
|
|
46
|
+
document.addEventListener('click', (event) => {
|
|
47
|
+
const choice = (event.target as Element | null)?.closest<HTMLElement>('[data-consent]')?.dataset.consent;
|
|
48
|
+
if (!box || !choice) return;
|
|
49
|
+
if (choice !== 'open') decide(choice as Answer);
|
|
50
|
+
box.hidden = choice !== 'open';
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { cn } from '@/lib/cn';
|
|
3
|
+
|
|
4
|
+
/** Optional React island stub. Hydrate only when interactivity is required. */
|
|
5
|
+
export function Counter({ initial = 0 }: { initial?: number }) {
|
|
6
|
+
const [count, setCount] = useState(initial);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<button
|
|
10
|
+
type="button"
|
|
11
|
+
className={cn(
|
|
12
|
+
'border border-[var(--color-rule)] bg-white px-3 py-2 text-sm font-medium text-[var(--color-ink)]',
|
|
13
|
+
'hover:border-[var(--color-accent)]',
|
|
14
|
+
)}
|
|
15
|
+
onClick={() => setCount((n) => n + 1)}
|
|
16
|
+
>
|
|
17
|
+
Island count: {count}
|
|
18
|
+
</button>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# `src/data/`
|
|
2
|
+
|
|
3
|
+
Put sourced numbers and scenario tables here (JSON/TS). Calculators and charts
|
|
4
|
+
should import from this folder instead of hard-coding figures in components.
|
|
5
|
+
|
|
6
|
+
Example shape for a tool site:
|
|
7
|
+
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"asOf": "2026-11-06",
|
|
11
|
+
"defaults": {},
|
|
12
|
+
"scenarios": {},
|
|
13
|
+
"sources": []
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Keep every figure with a source in docs or in the data file itself. Reader copy
|
|
18
|
+
still goes through `lint-copy` on build.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The site's tokens and type on one page, at /dev/styleguide/ under `npm run dev` only.
|
|
3
|
+
// Add each shared component here as it appears, so a change to one is checked in one place.
|
|
4
|
+
import BaseLayout from '@/layouts/BaseLayout.astro';
|
|
5
|
+
import { colors } from '@/lib/theme';
|
|
6
|
+
import { defaultLocale } from '../../site.config.mjs';
|
|
7
|
+
|
|
8
|
+
const tokens = ['paper', 'ink', 'muted', 'rule', 'accent', 'accent-soft'];
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<BaseLayout locale={defaultLocale} title="Styleguide" description="Tokens and type." noindex>
|
|
12
|
+
<main id="main" class="mx-auto w-full max-w-xl flex-1 space-y-12 px-6 py-16">
|
|
13
|
+
<section class="space-y-3">
|
|
14
|
+
<h2 class="text-sm text-[var(--color-muted)]">Color</h2>
|
|
15
|
+
<ul class="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
|
16
|
+
{tokens.map((name) => (
|
|
17
|
+
<li class="text-sm">
|
|
18
|
+
<span
|
|
19
|
+
class="block h-16 border border-[var(--color-rule)]"
|
|
20
|
+
style={`background: var(--color-${name})`}
|
|
21
|
+
/>
|
|
22
|
+
{name}
|
|
23
|
+
<span class="block text-[var(--color-muted)]">{colors(name).join(' · ')}</span>
|
|
24
|
+
</li>
|
|
25
|
+
))}
|
|
26
|
+
</ul>
|
|
27
|
+
</section>
|
|
28
|
+
<section class="space-y-3">
|
|
29
|
+
<h2 class="text-sm text-[var(--color-muted)]">Type</h2>
|
|
30
|
+
<h1 class="text-3xl">Heading one</h1>
|
|
31
|
+
<p>
|
|
32
|
+
Body text, with <a href="#main">a link</a> in it.
|
|
33
|
+
</p>
|
|
34
|
+
<p class="text-sm text-[var(--color-muted)]">Small muted text.</p>
|
|
35
|
+
</section>
|
|
36
|
+
<section class="space-y-3">
|
|
37
|
+
<h2 class="text-sm text-[var(--color-muted)]">Button</h2>
|
|
38
|
+
<button type="button" class="min-h-11 cursor-pointer border border-[var(--color-ink)] px-3">
|
|
39
|
+
Button
|
|
40
|
+
</button>
|
|
41
|
+
</section>
|
|
42
|
+
</main>
|
|
43
|
+
</BaseLayout>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="astro/client" />
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"name": "العربية",
|
|
4
|
+
"english": "Arabic",
|
|
5
|
+
"hreflang": "ar",
|
|
6
|
+
"ogLocale": "ar_AR",
|
|
7
|
+
"dir": "rtl",
|
|
8
|
+
"font": "system"
|
|
9
|
+
},
|
|
10
|
+
"description": "{{ONE_SENTENCE}}",
|
|
11
|
+
"ui": {
|
|
12
|
+
"skipToContent": "انتقل إلى المحتوى",
|
|
13
|
+
"language": "اللغة",
|
|
14
|
+
"about": "عن الموقع",
|
|
15
|
+
"aboutTitle": "عن {site}",
|
|
16
|
+
"aboutDescription": "ما هو {site} ولمن هو موجّه.",
|
|
17
|
+
"notFoundTitle": "الصفحة غير موجودة",
|
|
18
|
+
"notFoundBody": "هذه الصفحة غير موجودة. بقية الموقع ما زالت هنا.",
|
|
19
|
+
"backHome": "العودة إلى {site}",
|
|
20
|
+
"ogAlt": "صورة مشاركة {site}",
|
|
21
|
+
"consentBody": "ملفات تعريف الارتباط التحليلية تميّز الزائر العائد من الجديد. هل تسمح بها؟",
|
|
22
|
+
"consentYes": "سماح",
|
|
23
|
+
"consentNo": "رفض",
|
|
24
|
+
"consentOpen": "إعدادات ملفات تعريف الارتباط",
|
|
25
|
+
"privacy": "الخصوصية",
|
|
26
|
+
"privacyDescription": "ما الذي يسجّله {site} عن الزيارة، ومن تسأل عنه.",
|
|
27
|
+
"privacyBody": "Privacy text to write: name who runs {site}, each analytics tool it loads, what each records, and how to reach you."
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"name": "Deutsch",
|
|
4
|
+
"english": "German",
|
|
5
|
+
"hreflang": "de",
|
|
6
|
+
"ogLocale": "de_DE",
|
|
7
|
+
"dir": "ltr",
|
|
8
|
+
"font": "mono"
|
|
9
|
+
},
|
|
10
|
+
"description": "{{ONE_SENTENCE}}",
|
|
11
|
+
"ui": {
|
|
12
|
+
"skipToContent": "Zum Inhalt springen",
|
|
13
|
+
"language": "Sprache",
|
|
14
|
+
"about": "Über",
|
|
15
|
+
"aboutTitle": "Über {site}",
|
|
16
|
+
"aboutDescription": "Worum es bei {site} geht und für wen.",
|
|
17
|
+
"notFoundTitle": "Seite nicht gefunden",
|
|
18
|
+
"notFoundBody": "Diese Seite gibt es nicht. Der Rest der Website ist weiterhin da.",
|
|
19
|
+
"backHome": "Zurück zu {site}",
|
|
20
|
+
"ogAlt": "Vorschaubild von {site}",
|
|
21
|
+
"consentBody": "Analyse-Cookies unterscheiden wiederkehrende von neuen Besuchern. Erlauben?",
|
|
22
|
+
"consentYes": "Erlauben",
|
|
23
|
+
"consentNo": "Ablehnen",
|
|
24
|
+
"consentOpen": "Cookie-Einstellungen",
|
|
25
|
+
"privacy": "Datenschutz",
|
|
26
|
+
"privacyDescription": "Was {site} über einen Besuch aufzeichnet und an wen Sie sich dazu wenden.",
|
|
27
|
+
"privacyBody": "Privacy text to write: name who runs {site}, each analytics tool it loads, what each records, and how to reach you."
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"name": "English",
|
|
4
|
+
"english": "English",
|
|
5
|
+
"hreflang": "en",
|
|
6
|
+
"ogLocale": "en_US",
|
|
7
|
+
"dir": "ltr",
|
|
8
|
+
"font": "mono"
|
|
9
|
+
},
|
|
10
|
+
"description": "{{ONE_SENTENCE}}",
|
|
11
|
+
"ui": {
|
|
12
|
+
"skipToContent": "Skip to content",
|
|
13
|
+
"language": "Language",
|
|
14
|
+
"about": "About",
|
|
15
|
+
"aboutTitle": "About {site}",
|
|
16
|
+
"aboutDescription": "What {site} is and who it is for.",
|
|
17
|
+
"notFoundTitle": "Page not found",
|
|
18
|
+
"notFoundBody": "This page does not exist. The rest of the site is still here.",
|
|
19
|
+
"backHome": "Back to {site}",
|
|
20
|
+
"ogAlt": "{site} share card",
|
|
21
|
+
"consentBody": "Analytics cookies tell a returning visitor from a new one. Allow them?",
|
|
22
|
+
"consentYes": "Allow",
|
|
23
|
+
"consentNo": "Refuse",
|
|
24
|
+
"consentOpen": "Cookie settings",
|
|
25
|
+
"privacy": "Privacy",
|
|
26
|
+
"privacyDescription": "What {site} records about a visit, and who to ask about it.",
|
|
27
|
+
"privacyBody": "Privacy text to write: name who runs {site}, each analytics tool it loads, what each records, and how to reach you."
|
|
28
|
+
}
|
|
29
|
+
}
|