website 1.8.0: demo scenarios (the scenario's people lead, Events' events through the feed)

- `npm run demo -- --profile <p> --scenario <p>`: each profile's `scenarioTeam` names four
  parts, roles and portraits; the names are the scenario's people from @crosscode/demo, the
  pastor first (home page and messages' speaker).
- With a linked Cross Events, a scenario load makes no events of its own, turns on Show events
  from and fetches Events' whole feed at once; an unreachable Events doesn't fail the load.
- A scenario on a site with no church profile saves the scenario's church, not Acacia Hill.
- crosscode script: `crosscode demo <church> website --scenario` passes it on and refuses a
  Website before 1.8.0; the Website installs and builds packages/demo.
- Docs: HANDOVER, APP-1.0-PLAN, VERSIONS, CHANGELOGs, What's New.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 15:23:12 +02:00
co-authored by Claude Opus 5.5
parent b2a163bb39
commit c8e270dbf1
17 changed files with 315 additions and 76 deletions
+21 -3
View File
@@ -4,6 +4,9 @@
* npm run demo -- --template heritage|bold|community|clean [--force] the Acacia Hill church (development)
* npm run demo -- --profile <profile> [--force] one of the eight demo churches (1.3.0),
* keeping the church's profile and settings
* npm run demo -- --profile <profile> --scenario <profile> [--force] 1.8.0: as part of that demo scenario
* (its people lead; with Cross Events
* linked, Events' events through the feed)
* npm run demo -- --list the profiles
*
* It replaces the site's content, so a site that has been published needs --force. On a server,
@@ -22,7 +25,7 @@ const arg = (name: string) => {
const i = process.argv.indexOf(`--${name}`);
return i > 0 ? process.argv[i + 1] : undefined;
};
const usage = 'Usage: npm run demo -- --template heritage|bold|community|clean | --profile <profile> [--force] | --list';
const usage = 'Usage: npm run demo -- --template heritage|bold|community|clean | --profile <profile> [--scenario <profile>] [--force] | --list';
if (process.argv.includes('--list')) {
for (const s of demoSeeds()) console.log(`${s.id.padEnd(18)} ${s.label}`);
@@ -35,6 +38,18 @@ if (!what.success) {
process.exit(2);
}
// A demo scenario loads the profile of the same name (contracts agent.DEMO_SCENARIOS).
const scenarioArg = arg('scenario');
const scenario = scenarioArg !== undefined ? agent.demoScenarioSchema.safeParse(scenarioArg) : null;
if (scenario && !scenario.success) {
console.error(`Unknown scenario "${scenarioArg}" (npm run demo -- --list).`);
process.exit(2);
}
if (scenario && scenario.data !== profileArg) {
console.error(`The ${scenario.data} scenario loads the ${scenario.data} profile: --profile ${scenario.data} --scenario ${scenario.data}.`);
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' } } });
@@ -43,6 +58,9 @@ if (published && !process.argv.includes('--force')) {
await db.$disconnect();
process.exit(1);
}
const version = await loadDemo(ctx, what.data);
console.log(`Demo ${what.data} loaded and published (version ${version.number}).`);
const version = await loadDemo(ctx, what.data, { scenario: scenario?.data });
console.log(`Demo ${what.data}${scenario ? ' (demo scenario)' : ''} loaded and published (version ${version.number}).`);
const sync = version.eventsSync;
if (sync?.ok) console.log(`Showing Cross Events' events: ${sync.imported} fetched.`);
else if (sync) console.warn(`Cross Events' events couldn't be fetched yet (${sync.error}); the next sync, within 15 minutes, brings them.`);
await db.$disconnect();