@zero2webmaster/starter-kit 0.1.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/LICENSE +38 -0
- package/README.md +89 -0
- package/dist/brand.d.ts +72 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +198 -0
- package/dist/brand.js.map +1 -0
- package/dist/brief.d.ts +14 -0
- package/dist/brief.d.ts.map +1 -0
- package/dist/brief.js +47 -0
- package/dist/brief.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +82 -0
- package/dist/cli.js.map +1 -0
- package/dist/confirm.d.ts +45 -0
- package/dist/confirm.d.ts.map +1 -0
- package/dist/confirm.js +382 -0
- package/dist/confirm.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/parse-brief.d.ts +32 -0
- package/dist/parse-brief.d.ts.map +1 -0
- package/dist/parse-brief.js +298 -0
- package/dist/parse-brief.js.map +1 -0
- package/dist/scaffolders/cf-pages.d.ts +9 -0
- package/dist/scaffolders/cf-pages.d.ts.map +1 -0
- package/dist/scaffolders/cf-pages.js +259 -0
- package/dist/scaffolders/cf-pages.js.map +1 -0
- package/dist/scaffolders/cf-worker.d.ts +4 -0
- package/dist/scaffolders/cf-worker.d.ts.map +1 -0
- package/dist/scaffolders/cf-worker.js +112 -0
- package/dist/scaffolders/cf-worker.js.map +1 -0
- package/dist/scaffolders/common.d.ts +39 -0
- package/dist/scaffolders/common.d.ts.map +1 -0
- package/dist/scaffolders/common.js +441 -0
- package/dist/scaffolders/common.js.map +1 -0
- package/dist/scaffolders/index.d.ts +18 -0
- package/dist/scaffolders/index.d.ts.map +1 -0
- package/dist/scaffolders/index.js +40 -0
- package/dist/scaffolders/index.js.map +1 -0
- package/dist/scaffolders/library.d.ts +4 -0
- package/dist/scaffolders/library.d.ts.map +1 -0
- package/dist/scaffolders/library.js +122 -0
- package/dist/scaffolders/library.js.map +1 -0
- package/dist/scaffolders/nextjs.d.ts +10 -0
- package/dist/scaffolders/nextjs.d.ts.map +1 -0
- package/dist/scaffolders/nextjs.js +395 -0
- package/dist/scaffolders/nextjs.js.map +1 -0
- package/dist/scaffolders/protocol-repo.d.ts +4 -0
- package/dist/scaffolders/protocol-repo.d.ts.map +1 -0
- package/dist/scaffolders/protocol-repo.js +162 -0
- package/dist/scaffolders/protocol-repo.js.map +1 -0
- package/dist/scaffolders/python-service.d.ts +4 -0
- package/dist/scaffolders/python-service.d.ts.map +1 -0
- package/dist/scaffolders/python-service.js +144 -0
- package/dist/scaffolders/python-service.js.map +1 -0
- package/dist/scaffolders/wp-plugin.d.ts +4 -0
- package/dist/scaffolders/wp-plugin.d.ts.map +1 -0
- package/dist/scaffolders/wp-plugin.js +268 -0
- package/dist/scaffolders/wp-plugin.js.map +1 -0
- package/dist/standards.d.ts +65 -0
- package/dist/standards.d.ts.map +1 -0
- package/dist/standards.js +335 -0
- package/dist/standards.js.map +1 -0
- package/dist/substitute.d.ts +37 -0
- package/dist/substitute.d.ts.map +1 -0
- package/dist/substitute.js +98 -0
- package/dist/substitute.js.map +1 -0
- package/dist/summary.d.ts +20 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +191 -0
- package/dist/summary.js.map +1 -0
- package/dist/templates.d.ts +30 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +123 -0
- package/dist/templates.js.map +1 -0
- package/dist/wizard.d.ts +12 -0
- package/dist/wizard.d.ts.map +1 -0
- package/dist/wizard.js +158 -0
- package/dist/wizard.js.map +1 -0
- package/dist/writer.d.ts +62 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +367 -0
- package/dist/writer.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/scaffolders/library.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAgHrB,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,iBAAiB,GACvB,YAAY,EAAE,CAUhB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Scaffolder: `library` — TypeScript no-deploy library.
|
|
2
|
+
//
|
|
3
|
+
// No web surface, no /health, no Fathom, no SEO baseline. Just a clean npm
|
|
4
|
+
// package skeleton that compiles with `tsc` and exports a stub `version`.
|
|
5
|
+
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
6
|
+
const NARRATIVE = `## What this is
|
|
7
|
+
|
|
8
|
+
\`{{slug}}\` is a TypeScript library scaffolded under the {{brand_name}} brand. No deploy target, no \`/health\` endpoint, no analytics — this is a code library consumed by other projects.
|
|
9
|
+
|
|
10
|
+
**Quick start for contributors:**
|
|
11
|
+
|
|
12
|
+
\`\`\`bash
|
|
13
|
+
npm install
|
|
14
|
+
npm run typecheck
|
|
15
|
+
npm run build
|
|
16
|
+
npm test
|
|
17
|
+
\`\`\`
|
|
18
|
+
|
|
19
|
+
**Distribution:** publish via \`npm publish --access public\` (the package's \`publishConfig.access\` is set accordingly). For a private library, set \`"private": true\` in \`package.json\` and remove \`publishConfig\`.
|
|
20
|
+
`;
|
|
21
|
+
const PACKAGE_JSON_TEMPLATE = `{
|
|
22
|
+
"name": "@{{github_org}}/{{slug}}",
|
|
23
|
+
"version": "{{version}}",
|
|
24
|
+
"description": "{{description}}",
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "{{author}}",
|
|
27
|
+
"url": "{{author_url}}"
|
|
28
|
+
},
|
|
29
|
+
"license": "UNLICENSED",
|
|
30
|
+
"private": false,
|
|
31
|
+
"type": "module",
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=20"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc",
|
|
50
|
+
"typecheck": "tsc --noEmit",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"test:watch": "vitest",
|
|
53
|
+
"prepublishOnly": "npm run typecheck && npm run build"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^20.0.0",
|
|
57
|
+
"typescript": "^5.4.0",
|
|
58
|
+
"vitest": "^2.0.0"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/{{github_org}}/{{slug}}",
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "git+https://github.com/{{github_org}}/{{slug}}.git"
|
|
67
|
+
},
|
|
68
|
+
"bugs": {
|
|
69
|
+
"url": "https://github.com/{{github_org}}/{{slug}}/issues"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
const TSCONFIG_TEMPLATE = `{
|
|
74
|
+
"compilerOptions": {
|
|
75
|
+
"target": "ES2022",
|
|
76
|
+
"module": "NodeNext",
|
|
77
|
+
"moduleResolution": "NodeNext",
|
|
78
|
+
"lib": ["ES2022"],
|
|
79
|
+
"outDir": "./dist",
|
|
80
|
+
"rootDir": "./src",
|
|
81
|
+
"declaration": true,
|
|
82
|
+
"declarationMap": true,
|
|
83
|
+
"sourceMap": true,
|
|
84
|
+
"strict": true,
|
|
85
|
+
"noImplicitAny": true,
|
|
86
|
+
"strictNullChecks": true,
|
|
87
|
+
"noUnusedLocals": true,
|
|
88
|
+
"noUnusedParameters": true,
|
|
89
|
+
"noFallthroughCasesInSwitch": true,
|
|
90
|
+
"esModuleInterop": true,
|
|
91
|
+
"skipLibCheck": true,
|
|
92
|
+
"forceConsistentCasingInFileNames": true,
|
|
93
|
+
"resolveJsonModule": true
|
|
94
|
+
},
|
|
95
|
+
"include": ["src/**/*"],
|
|
96
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
const SRC_INDEX_TEMPLATE = `// {{slug}} — public API.
|
|
100
|
+
//
|
|
101
|
+
// {{description}}
|
|
102
|
+
|
|
103
|
+
export const version = "{{version}}";
|
|
104
|
+
`;
|
|
105
|
+
const LICENSE_TEMPLATE = `Proprietary License — © {{year}} {{author}}
|
|
106
|
+
|
|
107
|
+
All rights reserved. This software is the proprietary work of {{author}} and is licensed for use only under the terms of a separate written agreement with the author or {{brand_name}}. Unauthorized copying, modification, distribution, or use is prohibited.
|
|
108
|
+
|
|
109
|
+
For licensing inquiries, contact {{author_url}}.
|
|
110
|
+
`;
|
|
111
|
+
export function scaffoldLibrary(inputs, opts) {
|
|
112
|
+
const spec = resolveBrandSpec(inputs);
|
|
113
|
+
const base = commonBaseFiles(inputs, opts, NARRATIVE);
|
|
114
|
+
const typeSpecific = [
|
|
115
|
+
{ path: "package.json", content: sub(PACKAGE_JSON_TEMPLATE, inputs, opts, spec) },
|
|
116
|
+
{ path: "tsconfig.json", content: sub(TSCONFIG_TEMPLATE, inputs, opts, spec) },
|
|
117
|
+
{ path: "src/index.ts", content: sub(SRC_INDEX_TEMPLATE, inputs, opts, spec) },
|
|
118
|
+
{ path: "LICENSE", content: sub(LICENSE_TEMPLATE, inputs, opts, spec) },
|
|
119
|
+
];
|
|
120
|
+
return [...base, ...typeSpecific];
|
|
121
|
+
}
|
|
122
|
+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I,CAAC,EAAE;KACxE,CAAC;IACF,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,YAAY,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ScaffoldInputs } from "../index.js";
|
|
2
|
+
import { type ScaffoldFile, type ScaffolderOptions } from "./common.js";
|
|
3
|
+
export declare function scaffoldNextjs(inputs: ScaffoldInputs, opts?: ScaffolderOptions): ScaffoldFile[];
|
|
4
|
+
/**
|
|
5
|
+
* Exported for tests + the eventual standards-conflict resolver in Step 5 so
|
|
6
|
+
* they can assert / require the canonical SEO baseline file list without
|
|
7
|
+
* hardcoding the paths in two places.
|
|
8
|
+
*/
|
|
9
|
+
export declare const NEXTJS_SEO_BASELINE_PATHS: readonly ["app/layout.tsx", "app/page.tsx", "app/sitemap.ts", "app/robots.ts", "app/opengraph-image.tsx", "SEO-CHECKLIST.md", ".env.example"];
|
|
10
|
+
//# sourceMappingURL=nextjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../../src/scaffolders/nextjs.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAyVrB,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,iBAAiB,GACvB,YAAY,EAAE,CA0BhB;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,+IAQ5B,CAAC"}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
// Scaffolder: `nextjs` — Next.js App Router project with the full SEO
|
|
2
|
+
// baseline wired in at instantiation (per standing org requirement
|
|
3
|
+
// 2026-05-30).
|
|
4
|
+
//
|
|
5
|
+
// SEO baseline emitted by THIS scaffolder (the 7 mandatory items):
|
|
6
|
+
// 1. SSR/SSG — App Router pages are server-rendered by default.
|
|
7
|
+
// 2. Per-page metadata — root `metadata` in app/layout.tsx + per-page
|
|
8
|
+
// `metadata` in app/page.tsx with unique title, description, OG, Twitter.
|
|
9
|
+
// 3. Exactly one <h1> per page + semantic HTML — app/page.tsx wires it.
|
|
10
|
+
// 4. Image alt text — the page template uses next/image with `alt=""` /
|
|
11
|
+
// descriptive alt where appropriate (placeholder content uses semantic
|
|
12
|
+
// HTML; no decorative images at scaffold time).
|
|
13
|
+
// 5. JSON-LD — `Organization` schema injected in app/layout.tsx.
|
|
14
|
+
// 6. sitemap.xml + robots.txt — app/sitemap.ts + app/robots.ts; preview
|
|
15
|
+
// noindex gated on `VERCEL_ENV !== 'production'`.
|
|
16
|
+
// 7. Fathom — wired via `NEXT_PUBLIC_FATHOM_SITE_ID` env var (per
|
|
17
|
+
// [[fathom-analytics]]) in app/layout.tsx.
|
|
18
|
+
//
|
|
19
|
+
// Also emits: app/api/health/route.ts (DB-free), app/opengraph-image.tsx
|
|
20
|
+
// (placeholder), SEO-CHECKLIST.md (per-page checklist), `.env.example` with
|
|
21
|
+
// NEXT_PUBLIC_SITE_URL + NEXT_PUBLIC_FATHOM_SITE_ID stubs.
|
|
22
|
+
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
23
|
+
const NARRATIVE = `## What this is
|
|
24
|
+
|
|
25
|
+
\`{{slug}}\` is a Next.js App Router project scaffolded under the {{brand_name}} brand. The 7-item SEO baseline (per Z2W standing org requirement 2026-05-30) is wired in at instantiation.
|
|
26
|
+
|
|
27
|
+
**Quick start for contributors:**
|
|
28
|
+
|
|
29
|
+
\`\`\`bash
|
|
30
|
+
npm install
|
|
31
|
+
cp .env.example .env.local # then fill in NEXT_PUBLIC_FATHOM_SITE_ID + NEXT_PUBLIC_SITE_URL
|
|
32
|
+
npm run dev # http://localhost:3000
|
|
33
|
+
npm run build && npm start # production build
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
**SEO baseline (wired in):**
|
|
37
|
+
|
|
38
|
+
- \`app/layout.tsx\` — root \`metadata\` with \`title.template\`, \`title.default\`, \`description\`, \`openGraph\`, \`twitter\`, \`metadataBase\`; Fathom analytics; JSON-LD Organization schema.
|
|
39
|
+
- \`app/page.tsx\` — per-page \`metadata\` (unique title + description; never inherit defaults); exactly one \`<h1>\`; semantic HTML.
|
|
40
|
+
- \`app/sitemap.ts\` — sitemap generator; lists indexable pages.
|
|
41
|
+
- \`app/robots.ts\` — robots generator; preview/staging emits \`noindex\` (gated on \`VERCEL_ENV !== 'production'\`).
|
|
42
|
+
- \`app/opengraph-image.tsx\` — default OG image (replace placeholder before launch).
|
|
43
|
+
- \`SEO-CHECKLIST.md\` — per-page checklist; consult before adding new pages.
|
|
44
|
+
|
|
45
|
+
**Before launch:** run the SEO baseline pre-launch audit from CLAUDE.md.
|
|
46
|
+
|
|
47
|
+
**Health endpoint:** \`/api/health\` is DB-free per [[neon-postgres]].
|
|
48
|
+
`;
|
|
49
|
+
const PACKAGE_JSON_TEMPLATE = `{
|
|
50
|
+
"name": "{{slug}}",
|
|
51
|
+
"version": "{{version}}",
|
|
52
|
+
"description": "{{description}}",
|
|
53
|
+
"private": true,
|
|
54
|
+
"type": "module",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"dev": "next dev",
|
|
57
|
+
"build": "next build",
|
|
58
|
+
"start": "next start",
|
|
59
|
+
"lint": "next lint",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"next": "^15.0.0",
|
|
64
|
+
"react": "^19.0.0",
|
|
65
|
+
"react-dom": "^19.0.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/node": "^20.0.0",
|
|
69
|
+
"@types/react": "^19.0.0",
|
|
70
|
+
"@types/react-dom": "^19.0.0",
|
|
71
|
+
"typescript": "^5.4.0"
|
|
72
|
+
},
|
|
73
|
+
"homepage": "https://github.com/{{github_org}}/{{slug}}"
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
const NEXT_CONFIG_TEMPLATE = `/** @type {import('next').NextConfig} */
|
|
77
|
+
const nextConfig = {
|
|
78
|
+
reactStrictMode: true,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default nextConfig;
|
|
82
|
+
`;
|
|
83
|
+
const TSCONFIG_TEMPLATE = `{
|
|
84
|
+
"compilerOptions": {
|
|
85
|
+
"target": "ES2022",
|
|
86
|
+
"lib": ["dom", "dom.iterable", "ES2022"],
|
|
87
|
+
"allowJs": true,
|
|
88
|
+
"skipLibCheck": true,
|
|
89
|
+
"strict": true,
|
|
90
|
+
"noEmit": true,
|
|
91
|
+
"esModuleInterop": true,
|
|
92
|
+
"module": "ESNext",
|
|
93
|
+
"moduleResolution": "Bundler",
|
|
94
|
+
"resolveJsonModule": true,
|
|
95
|
+
"isolatedModules": true,
|
|
96
|
+
"jsx": "preserve",
|
|
97
|
+
"incremental": true,
|
|
98
|
+
"plugins": [{ "name": "next" }],
|
|
99
|
+
"paths": { "@/*": ["./*"] }
|
|
100
|
+
},
|
|
101
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
102
|
+
"exclude": ["node_modules"]
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
const APP_LAYOUT_TEMPLATE = `// Root layout — SEO baseline wiring per Z2W standing org requirement
|
|
106
|
+
// 2026-05-30. Every indexable page MUST export its own \`metadata\`; do not
|
|
107
|
+
// rely on these defaults to fill in per-page values.
|
|
108
|
+
|
|
109
|
+
import type { Metadata, Viewport } from "next";
|
|
110
|
+
import Script from "next/script";
|
|
111
|
+
|
|
112
|
+
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL ?? "https://{{slug}}.example.com";
|
|
113
|
+
const fathomSiteId = process.env.NEXT_PUBLIC_FATHOM_SITE_ID ?? "";
|
|
114
|
+
|
|
115
|
+
export const metadata: Metadata = {
|
|
116
|
+
metadataBase: new URL(siteUrl),
|
|
117
|
+
title: {
|
|
118
|
+
template: "%s | {{brand_name}}",
|
|
119
|
+
default: "{{brand_name}} — {{slug}}",
|
|
120
|
+
},
|
|
121
|
+
description: "{{description}}",
|
|
122
|
+
openGraph: {
|
|
123
|
+
title: "{{brand_name}} — {{slug}}",
|
|
124
|
+
description: "{{description}}",
|
|
125
|
+
type: "website",
|
|
126
|
+
url: siteUrl,
|
|
127
|
+
},
|
|
128
|
+
twitter: {
|
|
129
|
+
card: "summary_large_image",
|
|
130
|
+
title: "{{brand_name}} — {{slug}}",
|
|
131
|
+
description: "{{description}}",
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const viewport: Viewport = {
|
|
136
|
+
themeColor: "{{primary_color}}",
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const organizationJsonLd = {
|
|
140
|
+
"@context": "https://schema.org",
|
|
141
|
+
"@type": "Organization",
|
|
142
|
+
name: "{{brand_name}}",
|
|
143
|
+
url: siteUrl,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
147
|
+
return (
|
|
148
|
+
<html lang="en">
|
|
149
|
+
<head>
|
|
150
|
+
<link rel="canonical" href={siteUrl} />
|
|
151
|
+
<script
|
|
152
|
+
type="application/ld+json"
|
|
153
|
+
dangerouslySetInnerHTML={{ __html: JSON.stringify(organizationJsonLd) }}
|
|
154
|
+
/>
|
|
155
|
+
</head>
|
|
156
|
+
<body
|
|
157
|
+
style={{
|
|
158
|
+
fontSize: "18px",
|
|
159
|
+
lineHeight: 1.5,
|
|
160
|
+
margin: 0,
|
|
161
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
{fathomSiteId ? (
|
|
165
|
+
<Script
|
|
166
|
+
src="https://cdn.usefathom.com/script.js"
|
|
167
|
+
data-site={fathomSiteId}
|
|
168
|
+
data-auto="false"
|
|
169
|
+
strategy="afterInteractive"
|
|
170
|
+
/>
|
|
171
|
+
) : null}
|
|
172
|
+
{children}
|
|
173
|
+
</body>
|
|
174
|
+
</html>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
const APP_PAGE_TEMPLATE = `// Home page — per-page \`metadata\` is mandatory per SEO baseline. Replace
|
|
179
|
+
// the title + description with intentional, page-specific copy (do NOT
|
|
180
|
+
// inherit the root defaults).
|
|
181
|
+
|
|
182
|
+
import type { Metadata } from "next";
|
|
183
|
+
|
|
184
|
+
export const metadata: Metadata = {
|
|
185
|
+
title: "Home",
|
|
186
|
+
description: "{{description}}",
|
|
187
|
+
alternates: { canonical: "/" },
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export default function HomePage() {
|
|
191
|
+
return (
|
|
192
|
+
<main style={{ maxWidth: "960px", margin: "0 auto", padding: "2rem 1rem" }}>
|
|
193
|
+
<header>
|
|
194
|
+
<h1 style={{ color: "{{primary_color}}" }}>{{brand_name}} — {{slug}}</h1>
|
|
195
|
+
</header>
|
|
196
|
+
<article>
|
|
197
|
+
<p>{{description}}</p>
|
|
198
|
+
<p>
|
|
199
|
+
This page is server-rendered by default. Edit <code>app/page.tsx</code>
|
|
200
|
+
to replace the placeholder copy with your real homepage content.
|
|
201
|
+
</p>
|
|
202
|
+
</article>
|
|
203
|
+
<footer>
|
|
204
|
+
<p>© {{year}} {{author}}.</p>
|
|
205
|
+
</footer>
|
|
206
|
+
</main>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
210
|
+
const APP_HEALTH_ROUTE_TEMPLATE = `// DB-free health endpoint. Per [[neon-postgres]], do NOT add a database
|
|
211
|
+
// roundtrip here — routine probes burn through Neon Free's CU-hour quota.
|
|
212
|
+
|
|
213
|
+
import { NextResponse } from "next/server";
|
|
214
|
+
|
|
215
|
+
export const runtime = "nodejs";
|
|
216
|
+
export const dynamic = "force-dynamic";
|
|
217
|
+
|
|
218
|
+
export function GET() {
|
|
219
|
+
return NextResponse.json({ status: "ok" });
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
const APP_SITEMAP_TEMPLATE = `// Sitemap generator — lists every indexable page. Add new entries here when
|
|
223
|
+
// you add new indexable routes. Per SEO baseline.
|
|
224
|
+
|
|
225
|
+
import type { MetadataRoute } from "next";
|
|
226
|
+
|
|
227
|
+
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL ?? "https://{{slug}}.example.com";
|
|
228
|
+
|
|
229
|
+
export default function sitemap(): MetadataRoute.Sitemap {
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
url: siteUrl,
|
|
233
|
+
lastModified: new Date(),
|
|
234
|
+
changeFrequency: "weekly",
|
|
235
|
+
priority: 1,
|
|
236
|
+
},
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
`;
|
|
240
|
+
const APP_ROBOTS_TEMPLATE = `// Robots generator — production indexable, preview/staging noindex per SEO
|
|
241
|
+
// baseline. Gated on \`VERCEL_ENV\`; for non-Vercel hosts swap in the
|
|
242
|
+
// equivalent env var (e.g. \`CF_PAGES_BRANCH !== 'main'\`).
|
|
243
|
+
|
|
244
|
+
import type { MetadataRoute } from "next";
|
|
245
|
+
|
|
246
|
+
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL ?? "https://{{slug}}.example.com";
|
|
247
|
+
const isProduction = process.env.VERCEL_ENV === "production";
|
|
248
|
+
|
|
249
|
+
export default function robots(): MetadataRoute.Robots {
|
|
250
|
+
if (!isProduction) {
|
|
251
|
+
return {
|
|
252
|
+
rules: { userAgent: "*", disallow: "/" },
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
rules: { userAgent: "*", allow: "/" },
|
|
257
|
+
sitemap: \`\${siteUrl}/sitemap.xml\`,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
`;
|
|
261
|
+
const APP_OG_IMAGE_TEMPLATE = `// Default Open Graph image. Replace this placeholder with the real OG image
|
|
262
|
+
// before launch (per SEO baseline). Resolution: 1200x630.
|
|
263
|
+
|
|
264
|
+
import { ImageResponse } from "next/og";
|
|
265
|
+
|
|
266
|
+
export const runtime = "edge";
|
|
267
|
+
export const alt = "{{brand_name}} — {{slug}}";
|
|
268
|
+
export const size = { width: 1200, height: 630 };
|
|
269
|
+
export const contentType = "image/png";
|
|
270
|
+
|
|
271
|
+
export default function OpengraphImage() {
|
|
272
|
+
return new ImageResponse(
|
|
273
|
+
(
|
|
274
|
+
<div
|
|
275
|
+
style={{
|
|
276
|
+
fontSize: 64,
|
|
277
|
+
background: "{{primary_color}}",
|
|
278
|
+
color: "#ffffff",
|
|
279
|
+
width: "100%",
|
|
280
|
+
height: "100%",
|
|
281
|
+
display: "flex",
|
|
282
|
+
alignItems: "center",
|
|
283
|
+
justifyContent: "center",
|
|
284
|
+
fontFamily: "system-ui, sans-serif",
|
|
285
|
+
}}
|
|
286
|
+
>
|
|
287
|
+
{{brand_name}} — {{slug}}
|
|
288
|
+
</div>
|
|
289
|
+
),
|
|
290
|
+
{ ...size },
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
`;
|
|
294
|
+
const SEO_CHECKLIST_TEMPLATE = `# SEO Checklist — {{slug}}
|
|
295
|
+
|
|
296
|
+
Per Z2W standing org requirement 2026-05-30. Run before adding a new page AND before launch.
|
|
297
|
+
|
|
298
|
+
## Per-page checklist (every new page)
|
|
299
|
+
|
|
300
|
+
- [ ] Page exports its own \`metadata\` — unique title, unique description, canonical URL
|
|
301
|
+
- [ ] OG + Twitter Card tags present (set on \`metadata.openGraph\` / \`metadata.twitter\` or inherited intentionally)
|
|
302
|
+
- [ ] Page-specific OG image set if branding differs from default
|
|
303
|
+
- [ ] Exactly one \`<h1>\` stating the page's primary topic
|
|
304
|
+
- [ ] Heading hierarchy logical (H1 → H2 → H3, no skipped levels)
|
|
305
|
+
- [ ] Semantic HTML (\`<main>\`, \`<nav>\`, \`<article>\`, \`<header>\`, \`<footer>\`)
|
|
306
|
+
- [ ] Every meaningful image has descriptive alt text; decorative images use \`alt=""\`
|
|
307
|
+
- [ ] Page added to \`app/sitemap.ts\` if indexable
|
|
308
|
+
- [ ] JSON-LD added where content type warrants (Article / Event / Product / BreadcrumbList)
|
|
309
|
+
- [ ] Page is server-rendered (SSR/SSG, not client-only — verify in \`curl\` output)
|
|
310
|
+
|
|
311
|
+
## Pre-launch audit
|
|
312
|
+
|
|
313
|
+
- [ ] Indexable pages render primary content in raw HTML (\`curl <url>\` — not just the rendered DOM)
|
|
314
|
+
- [ ] Every page has unique intentional title + meta description; no duplicates, no defaults
|
|
315
|
+
- [ ] Exactly one \`<h1>\` per page; heading hierarchy logical
|
|
316
|
+
- [ ] Canonical URL set on every page
|
|
317
|
+
- [ ] OG + Twitter Card tags present; OG image resolves
|
|
318
|
+
- [ ] Meaningful images have descriptive alt text; decorative images have \`alt=""\`
|
|
319
|
+
- [ ] JSON-LD present where warranted; validates in Google Rich Results test
|
|
320
|
+
- [ ] \`sitemap.xml\` generates correctly; \`robots.txt\` references it
|
|
321
|
+
- [ ] Production is indexable; preview/staging is NOT indexable (\`curl -I <preview-url>\` shows \`X-Robots-Tag: noindex\` OR the page returns \`Disallow: /\`)
|
|
322
|
+
- [ ] Fathom snippet firing (verify in Fathom dashboard with a test pageview)
|
|
323
|
+
- [ ] Core Web Vitals reasonable (no obvious CLS, oversized images, render-blocking)
|
|
324
|
+
|
|
325
|
+
## Wired at instantiation by \`@zero2webmaster/starter-kit\`
|
|
326
|
+
|
|
327
|
+
- ✅ \`app/layout.tsx\` — root metadata + JSON-LD Organization
|
|
328
|
+
- ✅ \`app/page.tsx\` — per-page metadata template
|
|
329
|
+
- ✅ \`app/sitemap.ts\`
|
|
330
|
+
- ✅ \`app/robots.ts\` (preview-noindex gated on \`VERCEL_ENV\`)
|
|
331
|
+
- ✅ \`app/opengraph-image.tsx\` (placeholder — replace before launch)
|
|
332
|
+
- ✅ Fathom env var wired (\`NEXT_PUBLIC_FATHOM_SITE_ID\`)
|
|
333
|
+
- ✅ \`NEXT_PUBLIC_SITE_URL\` env var stub for \`metadataBase\`
|
|
334
|
+
|
|
335
|
+
## Still content-driven (you fill these in)
|
|
336
|
+
|
|
337
|
+
- ⏳ Real OG image (replace \`app/opengraph-image.tsx\` placeholder)
|
|
338
|
+
- ⏳ Per-page descriptions (replace placeholder copy in \`app/page.tsx\`)
|
|
339
|
+
- ⏳ JSON-LD types specific to each content kind (Article / Event / Product)
|
|
340
|
+
- ⏳ Real Fathom site ID in production env
|
|
341
|
+
- ⏳ Real \`NEXT_PUBLIC_SITE_URL\` in production env
|
|
342
|
+
`;
|
|
343
|
+
const ENV_EXAMPLE_TEMPLATE = `# {{slug}} — example environment variables.
|
|
344
|
+
# Copy to \`.env.local\` and fill in real values.
|
|
345
|
+
|
|
346
|
+
# Site URL (used by metadataBase + sitemap + robots).
|
|
347
|
+
# In production, set this to your live domain.
|
|
348
|
+
NEXT_PUBLIC_SITE_URL=https://{{slug}}.example.com
|
|
349
|
+
|
|
350
|
+
# Fathom Analytics site ID (per [[fathom-analytics]] convention).
|
|
351
|
+
# One Fathom site = one deployment.
|
|
352
|
+
NEXT_PUBLIC_FATHOM_SITE_ID=
|
|
353
|
+
`;
|
|
354
|
+
export function scaffoldNextjs(inputs, opts) {
|
|
355
|
+
const spec = resolveBrandSpec(inputs);
|
|
356
|
+
const base = commonBaseFiles(inputs, opts, NARRATIVE);
|
|
357
|
+
const typeSpecific = [
|
|
358
|
+
{ path: "package.json", content: sub(PACKAGE_JSON_TEMPLATE, inputs, opts, spec) },
|
|
359
|
+
{ path: "next.config.mjs", content: sub(NEXT_CONFIG_TEMPLATE, inputs, opts, spec) },
|
|
360
|
+
{ path: "tsconfig.json", content: sub(TSCONFIG_TEMPLATE, inputs, opts, spec) },
|
|
361
|
+
{ path: "app/layout.tsx", content: sub(APP_LAYOUT_TEMPLATE, inputs, opts, spec) },
|
|
362
|
+
{ path: "app/page.tsx", content: sub(APP_PAGE_TEMPLATE, inputs, opts, spec) },
|
|
363
|
+
{
|
|
364
|
+
path: "app/api/health/route.ts",
|
|
365
|
+
content: sub(APP_HEALTH_ROUTE_TEMPLATE, inputs, opts, spec),
|
|
366
|
+
},
|
|
367
|
+
{ path: "app/sitemap.ts", content: sub(APP_SITEMAP_TEMPLATE, inputs, opts, spec) },
|
|
368
|
+
{ path: "app/robots.ts", content: sub(APP_ROBOTS_TEMPLATE, inputs, opts, spec) },
|
|
369
|
+
{
|
|
370
|
+
path: "app/opengraph-image.tsx",
|
|
371
|
+
content: sub(APP_OG_IMAGE_TEMPLATE, inputs, opts, spec),
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
path: "SEO-CHECKLIST.md",
|
|
375
|
+
content: sub(SEO_CHECKLIST_TEMPLATE, inputs, opts, spec),
|
|
376
|
+
},
|
|
377
|
+
{ path: ".env.example", content: sub(ENV_EXAMPLE_TEMPLATE, inputs, opts, spec) },
|
|
378
|
+
];
|
|
379
|
+
return [...base, ...typeSpecific];
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Exported for tests + the eventual standards-conflict resolver in Step 5 so
|
|
383
|
+
* they can assert / require the canonical SEO baseline file list without
|
|
384
|
+
* hardcoding the paths in two places.
|
|
385
|
+
*/
|
|
386
|
+
export const NEXTJS_SEO_BASELINE_PATHS = [
|
|
387
|
+
"app/layout.tsx",
|
|
388
|
+
"app/page.tsx",
|
|
389
|
+
"app/sitemap.ts",
|
|
390
|
+
"app/robots.ts",
|
|
391
|
+
"app/opengraph-image.tsx",
|
|
392
|
+
"SEO-CHECKLIST.md",
|
|
393
|
+
".env.example",
|
|
394
|
+
];
|
|
395
|
+
//# sourceMappingURL=nextjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs.js","sourceRoot":"","sources":["../../src/scaffolders/nextjs.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,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E,IAAI,CAAC;SACxD;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,GAAG,CAAC,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACzD;QACD,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;KACjF,CAAC;IACF,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,YAAY,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CACN,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScaffoldInputs } from "../index.js";
|
|
2
|
+
import { type ScaffoldFile, type ScaffolderOptions } from "./common.js";
|
|
3
|
+
export declare function scaffoldProtocolRepo(inputs: ScaffoldInputs, opts?: ScaffolderOptions): ScaffoldFile[];
|
|
4
|
+
//# sourceMappingURL=protocol-repo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-repo.d.ts","sourceRoot":"","sources":["../../src/scaffolders/protocol-repo.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAoIrB,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,iBAAiB,GACvB,YAAY,EAAE,CAkBhB"}
|