feat(website): the four templates and the public site
Heritage, Bold, Community and Clean drawing all 26 section variants with their headers, homepage order and style settings; colours made safe (WCAG AA) by the backend; fonts and corners from the shared brand style. Publishing into numbered versions, the content API with live messages and events and the church profile from Accounts, uploads, every page kind, simple event pages, Coming soon, 404, sitemap, SEO basics and the church's JSON-LD. The demo church (npm run demo) and Playwright e2e: every template's pages pass axe and the SEO checks. website.sh builds packages/seo. Decision 17 (first Owner) recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Loads the demo church (src/demo/demoChurch.ts) into a template and publishes it.
|
||||
*
|
||||
* npm run demo -- --template heritage|bold|community|clean [--force]
|
||||
*
|
||||
* It replaces the site's content, so a site that has been published needs --force.
|
||||
*/
|
||||
import 'dotenv/config';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { websiteTemplateSchema } from '@crosscode/contracts';
|
||||
import { PrismaClient } from '../src/generated/prisma/client.js';
|
||||
import { createCtx } from '../src/context.js';
|
||||
import { loadDemo } from '../src/demo/demoChurch.js';
|
||||
import { loadConfig } from '../src/lib/config.js';
|
||||
|
||||
const arg = (name: string) => {
|
||||
const i = process.argv.indexOf(`--${name}`);
|
||||
return i > 0 ? process.argv[i + 1] : undefined;
|
||||
};
|
||||
const template = websiteTemplateSchema.safeParse(arg('template') ?? 'heritage');
|
||||
if (!template.success) {
|
||||
console.error('Usage: npm run demo -- --template heritage|bold|community|clean [--force]');
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const db = new PrismaClient({ adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL! }) });
|
||||
const ctx = createCtx(loadConfig(), db);
|
||||
const published = await db.siteVersion.findFirst({ where: { NOT: { publishedBy: 'demo' } } });
|
||||
if (published && !process.argv.includes('--force')) {
|
||||
console.error('This site has been published by its admins: loading the demo would replace their content. Add --force to do it anyway.');
|
||||
await db.$disconnect();
|
||||
process.exit(1);
|
||||
}
|
||||
const version = await loadDemo(ctx, template.data);
|
||||
console.log(`Demo church loaded on ${template.data} and published (version ${version.number}).`);
|
||||
await db.$disconnect();
|
||||
Reference in New Issue
Block a user