test: the Website e2e server loads a demo profile (/test/demo?profile=); docs: crosscode.co.za 1.8.0 released

For the crosscode-site screenshots of another church on each template. Test
helper only, no Website release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 14:47:01 +02:00
co-authored by Claude Opus 5.5
parent 9c87208428
commit 090453e14a
2 changed files with 19 additions and 3 deletions
+11 -2
View File
@@ -4,7 +4,8 @@
* (freshPostgres, below), and the demo church published. The pages run as a production build on
* 3310 and send /api here.
*
* Test helpers: POST /test/demo?template=<id> loads the demo church on that template;
* Test helpers: POST /test/demo?template=<id> loads the demo church on that template (or
* ?profile=<id>, a demo profile);
* POST /test/design { variants?, style?, home? } changes the design and publishes again.
*/
import { execSync } from 'node:child_process';
@@ -15,7 +16,7 @@ import express from 'express';
import pg from 'pg';
import sharp from 'sharp';
import { PrismaPg } from '@prisma/adapter-pg';
import { websiteTemplateSchema } from '@crosscode/contracts';
import { agent, websiteTemplateSchema } from '@crosscode/contracts';
import { PrismaClient } from '../backend/src/generated/prisma/client.js';
import { createApp } from '../backend/src/app.js';
import { createCtx } from '../backend/src/context.js';
@@ -67,6 +68,14 @@ await loadDemo(ctx, websiteTemplateSchema.parse(process.env.DEMO_TEMPLATE ?? 'he
const app = express();
app.post('/test/demo', async (req, res) => {
// ?profile=<id>: one of the demo profiles (the crosscode-site screenshots of another church on
// a template); it keeps the church profile the template demo saved (Acacia Hill).
const profile = String(req.query.profile ?? '');
if (profile) {
if (!(agent.WEBSITE_DEMO_PROFILES as readonly string[]).includes(profile)) return res.status(400).json({ error: 'profile' });
await loadDemo(ctx, profile as agent.WebsiteDemoProfile, { uploadDir: uploads });
return res.json({ ok: true, profile });
}
const t = websiteTemplateSchema.safeParse(req.query.template);
if (!t.success) return res.status(400).json({ error: 'template' });
await loadDemo(ctx, t.data, { uploadDir: uploads });