From c8e270dbf19feffb3f040ab4ff75c26c72375f85 Mon Sep 17 00:00:00 2001 From: Joshua Oosthuizen Date: Mon, 30 Nov 2026 15:23:12 +0200 Subject: [PATCH] website 1.8.0: demo scenarios (the scenario's people lead, Events' events through the feed) - `npm run demo -- --profile

--scenario

`: 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 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 --- CHANGELOG.md | 12 +++ apps/website/CHANGELOG.md | 26 +++++++ apps/website/WHATS-NEW.md | 6 ++ apps/website/backend/package.json | 3 +- apps/website/backend/scripts/demo.ts | 24 +++++- apps/website/backend/src/demo/demoChurch.ts | 77 ++++++++++++++++--- apps/website/backend/src/demo/seeds.ts | 26 ++++++- apps/website/backend/tests/site.test.ts | 84 ++++++++++++++++++++- apps/website/frontend/package.json | 2 +- docs/APP-1.0-PLAN.md | 12 +-- docs/HANDOVER.md | 46 +++-------- docs/VERSIONS.md | 14 +++- package-lock.json | 5 +- scripts/lib/manage.sh | 19 +++-- scripts/products/website.sh | 7 +- scripts/tests/demo.bats | 17 ++++- scripts/tests/website.bats | 11 +++ 17 files changed, 315 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adf8263..a0a2f2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …). +## website@1.8.0 + crosscode script - 2026-11-30 + +Church App 1.0.0 groundwork in the Church Website (docs/APP-1.0-PLAN.md §12, "Demo scenarios"). No +migration. Details in `apps/website/CHANGELOG.md`. + +- **Website 1.8.0:** `npm run demo -- --profile

--scenario

` loads a profile as part of its + demo scenario: the leaders are the scenario's people (`@crosscode/demo`), the pastor the home + page's and the messages' speaker; with a linked Cross Events, Events' events show through the + feed (Show events from, fetched at once) instead of the profile's own. +- **crosscode script:** `crosscode demo website … --scenario

` passes it on and refuses a + Website before 1.8.0; the Website installs and builds `packages/demo`. + ## contracts@1.22.0 - 2026-11-30 Bible translations for the Church App's devotionals (docs/BIBLE-PERMISSIONS.md, APP-1.0-PLAN.md §6 diff --git a/apps/website/CHANGELOG.md b/apps/website/CHANGELOG.md index bf8a6fd..ce6cedb 100644 --- a/apps/website/CHANGELOG.md +++ b/apps/website/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog — Church Website +## [1.8.0] — 2026-11-30 + +No migration, no new environment settings. The backend now uses `@crosscode/demo` (built by +`crosscode deploy` with the other shared packages). + +### Added + +- **Demo scenarios** (APP-1.0-PLAN §12): `npm run demo -- --profile

--scenario

` (the + scenario must be the profile of the same name) loads a profile as part of the scenario, so the + Website shows the same church as Accounts, Cross Events and the App. + - **Leaders:** each profile's `scenarioTeam` (`src/demo/seeds.ts`) names four parts, roles and + portraits, the pastor first; the names are the scenario's people from `demoPeople`. The pastor + is the home page's pastor and the messages' speaker, and every portrait's alt text is the new + name. None of the profile's own leader names is left. + - **Events:** with a linked Cross Events, a scenario load makes no simple events of its own (and + no pictures for them), turns on that link's **Show events from** and fetches Events' whole + feed at once (`syncLink`, full), so Events' events show, never copied. If Events can't be + reached the load still succeeds and says so; the 15-minute sync catches up. Without Events, the + profile's own three events, as before. + - On a site with no church profile at all, a scenario saves the scenario's church (from + `@crosscode/demo`) instead of Acacia Hill. +- `crosscode demo website --profile

--scenario

` passes `--scenario` on (agent + 1.7.0 sends it for the Hub's **Load a demo scenario**) and refuses a release before 1.8.0; + `packages/demo` joins the Website's shared packages (`website_shared_packages`, + `website_build`). + ## [1.7.1] — 2026-11-28 One migration (`20261128000000_photo_framing`: a nullable `framing` column on `Ministry`, diff --git a/apps/website/WHATS-NEW.md b/apps/website/WHATS-NEW.md index 69f4338..afd93b0 100644 --- a/apps/website/WHATS-NEW.md +++ b/apps/website/WHATS-NEW.md @@ -3,6 +3,12 @@ What each version changes for the church, in plain language (read by the Hub like Cross Events' WHATS-NEW.md; a section shows once its version is tagged). +## 1.8.0 + +- Behind the scenes, Cross Code's demonstration websites can now be loaded as part of a whole demo + church, with the same people and events as its Accounts, Events site and App. Nothing changes on + your own website. + ## 1.7.1 - **Move and zoom now works for ministries, your team and events too**, not only for page diff --git a/apps/website/backend/package.json b/apps/website/backend/package.json index 49bede4..c76683a 100644 --- a/apps/website/backend/package.json +++ b/apps/website/backend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/website-backend", - "version": "1.7.1", + "version": "1.8.0", "description": "Church Website: the public site's content API, the admin API, publishing and uploads", "private": true, "type": "module", @@ -20,6 +20,7 @@ "dependencies": { "@crosscode/auth-client": "*", "@crosscode/contracts": "*", + "@crosscode/demo": "*", "@prisma/adapter-pg": "^7.10.1", "@prisma/client": "^7.10.1", "cron-parser": "^5.10.2", diff --git a/apps/website/backend/scripts/demo.ts b/apps/website/backend/scripts/demo.ts index 4150e7a..1b8a0c4 100644 --- a/apps/website/backend/scripts/demo.ts +++ b/apps/website/backend/scripts/demo.ts @@ -4,6 +4,9 @@ * npm run demo -- --template heritage|bold|community|clean [--force] the Acacia Hill church (development) * npm run demo -- --profile [--force] one of the eight demo churches (1.3.0), * keeping the church's profile and settings + * npm run demo -- --profile --scenario [--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 [--force] | --list'; +const usage = 'Usage: npm run demo -- --template heritage|bold|community|clean | --profile [--scenario ] [--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(); diff --git a/apps/website/backend/src/demo/demoChurch.ts b/apps/website/backend/src/demo/demoChurch.ts index aa851dc..a4ea3b9 100644 --- a/apps/website/backend/src/demo/demoChurch.ts +++ b/apps/website/backend/src/demo/demoChurch.ts @@ -8,6 +8,10 @@ * icon and the admins, and name the church in the copy. A template alone (development, e2e) is * still Acacia Hill, profile and all, exactly as before. * + * 1.8.0: a demo scenario (`--scenario`, APP-1.0-PLAN §12) loads a profile as part of the same + * church in every product: the leaders are the scenario's people (`@crosscode/demo`), and with a + * linked Cross Events the site shows Events' events through the feed instead of making its own. + * * It replaces the Website's content (never the admins), so the script refuses on a site that has * been published unless told otherwise. */ @@ -18,12 +22,13 @@ import { fileURLToPath } from 'node:url'; import { CHURCH_SCHEMA, WEBSITE_TEMPLATES, type agent, type Church, type WebsiteTemplate } from '@crosscode/contracts'; import type { Ctx } from '../context.js'; import { churchProfile } from '../church/profile.js'; -import { markRemoved, notifyLinks } from '../feed/feed.js'; +import { demoChurch, demoParts, demoPeople } from '@crosscode/demo'; +import { markRemoved, notifyLinks, syncLink, type SyncResult } from '../feed/feed.js'; import type { SectionData } from '../site/sections.js'; import { publish } from '../site/snapshot.js'; import { TEMPLATE_HEADERS, TEMPLATE_VARIANTS, SECTION_TYPES, defaultDesign, type SiteDesign } from '../site/variants.js'; import { MAX_WIDTH, WIDTHS, processImage, type Sizes } from '../admin/media.js'; -import { DEMO_SEEDS, type DemoPhotos, type DemoSeed } from './seeds.js'; +import { DEMO_SEEDS, type DemoPhotos, type DemoSeed, type ProfileSeed } from './seeds.js'; export const DEMO_COLOURS = { primary: '#1d5c63', accent: '#e0a458' }; @@ -57,6 +62,41 @@ export function demoProfile(publicUrl: string): Church { } as Church; } +/** + * 1.8.0: a scenario's church as a profile, for a scenario loaded on a site that has no profile at + * all (Accounts normally has it first and the site reads it from there). + */ +export function scenarioProfile(publicUrl: string, scenario: agent.DemoScenarioKey): Church { + const p = demoChurch(scenario).profile; + const base = demoProfile(publicUrl); + return { + ...base, + name: p.name, shortName: p.shortName, timezone: p.timezone, locale: p.locale, campuses: p.campuses, serviceTimes: p.serviceTimes, social: p.social, + branding: { ...base.branding, colours: p.colours, style: p.style }, + contact: { ...p.contact, phone: null, whatsapp: null }, + links: { ...base.links, accounts: `https://example.com/accounts/${demoChurch(scenario).slug}` }, + } as Church; +} + +/** + * 1.8.0: a profile's seed with the scenario's people as its leaders (`scenarioTeam`), the pastor + * first, each with the portrait chosen for them. + */ +export function scenarioSeed(seed: ProfileSeed, scenario: agent.DemoScenarioKey): DemoSeed { + const parts = demoParts(scenario); + const leads = demoPeople(scenario).filter((p) => parts.has(p.email)); + const team = seed.scenarioTeam.map(([part, role, photo]) => { + const person = leads.find((p) => parts.get(p.email)!.includes(part)); + if (!person) throw new Error(`The ${scenario} scenario has no one who is ${part}.`); + return { name: person.name, role, photo }; + }); + return { + ...seed, + leaders: team.map((l) => [l.name, l.role]), + photos: { ...seed.photos, pastor: team[0]!.photo, team: [team[1]!.photo, team[2]!.photo, team[3]!.photo] }, + }; +} + /** Hills, a sun and a path in the church's colours (SVG): what stands in for a demo photo that is missing. */ export function illustration(seed: number, w = 1600, h = 1000, colours: { primary: string; accent: string } = DEMO_COLOURS): string { const hues = [colours.primary, colours.accent, '#7fb7be', '#f3e3c3', '#284b52']; @@ -132,14 +172,14 @@ async function demoAsset(ctx: Ctx, uploadDir: string, key: string, alt: string, } /** The demo's pictures by slot (hero, collage2, collage3, welcome, pastor, invite, and the four ministries). */ -async function demoMedia(ctx: Ctx, uploadDir: string, photos: DemoPhotos, pastorName: string, team: string[], colours: { primary: string; accent: string }): Promise { +async function demoMedia(ctx: Ctx, uploadDir: string, photos: DemoPhotos, pastorName: string, team: string[], colours: { primary: string; accent: string }, withEvents: boolean): Promise { const slots: [string, string, string | null][] = [ ['hero', photos.hero, null], ['collage2', photos.collage[0], null], ['collage3', photos.collage[1], null], ['welcome', photos.welcome, null], ['pastor', photos.pastor, pastorName], ['invite', photos.invite, null], ...photos.ministries.map((p, i) => [`ministry${i}`, p, null] as [string, string, string | null]), ...photos.team.map((p, i) => [`team${i}`, p, team[i] ?? null] as [string, string, string | null]), ...photos.messages.map((p, i) => [`message${i}`, p, null] as [string, string, string | null]), - ...photos.events.map((p, i) => [`event${i}`, p, null] as [string, string, string | null]), + ...(withEvents ? photos.events : []).map((p, i) => [`event${i}`, p, null] as [string, string, string | null]), ]; fs.mkdirSync(path.join(uploadDir, 'demo'), { recursive: true }); const ids: Ids = {}; @@ -224,18 +264,27 @@ export const isDemoTemplate = (v: string): v is WebsiteTemplate => (WEBSITE_TEMP * Replaces the content with a demo, then publishes it. `what`: a template (the Acacia Hill church, * its profile saved too) or a demo profile (keeps the church's profile; Acacia Hill's is saved * only on a site that has none at all, so the site still has a name). + * + * `scenario` (1.8.0): part of loading that demo scenario, whose church the profile is (the same + * name: the script refuses any other). The leaders are the scenario's people, and with a linked + * Cross Events the site makes no events of its own: it shows Events' through the feed. */ -export async function loadDemo(ctx: Ctx, what: WebsiteTemplate | agent.WebsiteDemoProfile, opts: { uploadDir?: string; publishedBy?: string } = {}) { +export async function loadDemo(ctx: Ctx, what: WebsiteTemplate | agent.WebsiteDemoProfile, opts: { uploadDir?: string; publishedBy?: string; scenario?: agent.DemoScenarioKey } = {}) { const db = ctx.db; const uploadDir = opts.uploadDir ?? ctx.config.uploadDir ?? defaultUploadDir(); const classic = isDemoTemplate(what); - const seed: DemoSeed = classic ? { ...CLASSIC, template: what } : DEMO_SEEDS[what]; + const scenario = opts.scenario ?? null; + if (scenario && scenario !== what) throw new Error(`The ${scenario} scenario loads the ${scenario} profile, not ${what}.`); + const seed: DemoSeed = classic ? { ...CLASSIC, template: what } : scenario ? scenarioSeed(DEMO_SEEDS[what], scenario) : DEMO_SEEDS[what]; const extra = classic ? CLASSIC : null; + // A scenario's events are Cross Events' when the church has it: shown through the feed, never copied. + const eventsLink = scenario ? await db.productLink.findFirst({ where: { product: 'events' } }) : null; - // The church: Acacia Hill for a template; else whoever the site belongs to. + // The church: Acacia Hill for a template; else whoever the site belongs to (in a scenario, + // Accounts has the scenario's church by now). let church = classic ? null : await churchProfile(ctx); if (!church) { - church = demoProfile(ctx.config.publicUrl); + church = scenario ? scenarioProfile(ctx.config.publicUrl, scenario) : demoProfile(ctx.config.publicUrl); await ctx.settings.set('church_profile_local', JSON.stringify(church)); } const name = church.name; @@ -261,7 +310,7 @@ export async function loadDemo(ctx: Ctx, what: WebsiteTemplate | agent.WebsiteDe const [pastorName] = seed.leaders[0]!; const ministryNames = seed.ministries.map(([, n]) => t(n)); const speaker = extra?.pastorName ?? pastorName; - const img = await demoMedia(ctx, uploadDir, seed.photos, speaker, seed.leaders.slice(1).map(([name]) => name), colours); + const img = await demoMedia(ctx, uploadDir, seed.photos, speaker, seed.leaders.slice(1).map(([name]) => name), colours, !eventsLink); const design = classic ? defaultDesign(seed.template) : seedDesign(seed.template, seed.alternate); await db.siteDesign.create({ data: { id: 1, template: seed.template, variants: design.variants as never, home: design.home as never, style: design.style as never } }); @@ -330,12 +379,18 @@ export async function loadDemo(ctx: Ctx, what: WebsiteTemplate | agent.WebsiteDe } n = 0; const made: string[] = []; - for (const [slug, title, inDays, description] of seed.events) { + for (const [slug, title, inDays, description] of eventsLink ? [] : seed.events) { const startsAt = new Date(Math.floor((now.getTime() + inDays * day) / day) * day + 8 * 3600e3); made.push((await db.simpleEvent.create({ data: { slug, title, startsAt, endsAt: new Date(startsAt.getTime() + 3 * 3600e3), location: t(seed.venue), description: t(description), imageId: img[`event${n++}`] ?? null, publishedAt: now } })).id); } const version = await publish(ctx, { id: opts.publishedBy ?? 'demo', role: 'system' }, classic ? `Demo church on ${seed.template}` : `Demo: ${seed.label}`); // Linked products fetch the feed now, not at their next poll (one try; the poll catches up). await notifyLinks(ctx, [...gone, ...made]).catch(() => {}); - return version; + let eventsSync: SyncResult | null = null; + if (eventsLink) { + // Show Events' events (the scenario loaded them just before), the whole list at once. + const link = await db.productLink.update({ where: { installId: eventsLink.installId }, data: { showEvents: true } }); + eventsSync = await syncLink(ctx, link, { full: true }); + } + return { ...version, eventsSync }; } diff --git a/apps/website/backend/src/demo/seeds.ts b/apps/website/backend/src/demo/seeds.ts index fc58c63..221bbd4 100644 --- a/apps/website/backend/src/demo/seeds.ts +++ b/apps/website/backend/src/demo/seeds.ts @@ -8,9 +8,15 @@ * profile of each template starts on the template's other recommended variants and header, so the * eight show every recommended look. * + * 1.8.0: a profile is also a demo scenario's church (contracts `agent.DEMO_SCENARIOS`, APP-1.0-PLAN + * §12). Loaded as part of the scenario (`--scenario`), its leaders are the scenario's people from + * `@crosscode/demo` (`scenarioTeam`: their part, role and portrait), the same people as in Accounts, + * Cross Events and the App. + * * Every person and place in here is made up. A profile id never changes once released. */ import { agent, type WebsiteTemplate } from '@crosscode/contracts'; +import type { DemoPart } from '@crosscode/demo'; type WebsiteDemoProfile = agent.WebsiteDemoProfile; @@ -36,6 +42,11 @@ export type DemoSeed = { ministries: [string, string, string][]; /** Four: [name, role]. The first is the pastor on the home page and the speaker of the messages. */ leaders: [string, string][]; + /** + * 1.8.0, a scenario load: four leaders as [part, role, portrait], the pastor first. Their names + * are the scenario's people with that part (`demoPeople`); the portraits suit them (photos.json). + */ + scenarioTeam?: [DemoPart, string, string][]; series: [string, string]; /** Three: [slug, title, days ago, passage]. */ messages: [string, string, number, string][]; @@ -68,7 +79,10 @@ export type DemoPhotos = { const visitButton: Button = { label: 'Plan your visit', href: '/visit' }; -export const DEMO_SEEDS: Record = { +/** A demo profile: one of the eight, each also a demo scenario's church. */ +export type ProfileSeed = DemoSeed & { id: WebsiteDemoProfile; scenarioTeam: [DemoPart, string, string][] }; + +export const DEMO_SEEDS: Record = { 'heritage-parish': { id: 'heritage-parish', template: 'heritage', label: 'Heritage: a parish church with a long history', alternate: false, hero: { headline: 'Worshipping together since 1896', subline: 'An old church with a warm welcome in the heart of {city}. Traditional services, every generation together.', button: visitButton }, @@ -95,6 +109,7 @@ export const DEMO_SEEDS: Record = { ['pastoral-care', 'Pastoral visiting', 'Home communion and visits for those who can\'t come to church.'], ], leaders: [['The Revd Margaret Pillay', 'Rector'], ['The Revd Sipho Ndlovu', 'Assistant priest'], ['Anne Fourie', 'Director of music'], ['David Smith', 'Churchwarden']], + scenarioTeam: [['pastor', 'Rector', 'pastor-margaret'], ['worship', 'Director of music', 'team-sipho'], ['kids', 'Sunday school', 'team-anne'], ['prayer-coordinator', 'Prayer coordinator', 'team-david']], series: ['the-lords-prayer', 'The Lord\'s Prayer'], messages: [['your-kingdom-come', 'Your kingdom come', 3, 'Matthew 6:10'], ['our-daily-bread', 'Our daily bread', 10, 'Matthew 6:11'], ['forgive-us', 'Forgive us as we forgive', 17, 'Matthew 6:12']], events: [ @@ -131,6 +146,7 @@ export const DEMO_SEEDS: Record = { ['soup-kitchen', 'The soup kitchen', 'Soup and bread for anyone who needs it, every weekday at noon.'], ], leaders: [['Canon Peter Mahlangu', 'Vicar'], ['The Revd Claire Jacobs', 'City chaplain'], ['Tom Venter', 'Organist'], ['Nomsa Khumalo', 'Soup kitchen coordinator']], + scenarioTeam: [['pastor', 'Vicar', 'pastor-peter'], ['prayer-coordinator', 'Prayer coordinator', 'team-claire'], ['worship', 'Organist', 'team-nomsa'], ['youth', 'Students and young adults', 'team-tom']], series: ['songs-of-ascent', 'Songs of Ascent'], messages: [['unless-the-lord-builds', 'Unless the Lord builds the house', 4, 'Psalm 127'], ['i-lift-up-my-eyes', 'I lift up my eyes', 11, 'Psalm 121'], ['how-good-and-pleasant', 'How good and pleasant', 18, 'Psalm 133']], events: [ @@ -167,6 +183,7 @@ export const DEMO_SEEDS: Record = { ['groups', 'Connect groups', 'Meet in a home during the week and do life together.'], ], leaders: [['Jason and Lindi Naidoo', 'Lead pastors'], ['Kagiso Molefe', 'Youth pastor'], ['Megan Steyn', 'Worship pastor'], ['Ruan Pretorius', 'Connect groups']], + scenarioTeam: [['pastor', 'Lead pastor', 'team-kagiso'], ['youth', 'Youth pastor', 'team-ayesha'], ['worship', 'Worship pastor', 'team-megan'], ['prayer-coordinator', 'Prayer and connect groups', 'team-ruan']], series: ['unstoppable', 'Unstoppable'], messages: [['fearless', 'Fearless', 3, 'Joshua 1:9'], ['all-in', 'All in', 10, 'Romans 12:1-2'], ['no-turning-back', 'No turning back', 17, 'Luke 9:62']], events: [ @@ -203,6 +220,7 @@ export const DEMO_SEEDS: Record = { ['dinner-church', 'Dinner church', 'Supper and a conversation about Jesus on Wednesdays.'], ], leaders: [['Ben and Zanele Moore', 'Church planters'], ['Ayesha Patel', 'Kids'], ['Chris Hendricks', 'Music'], ['Grace Okafor', 'Community']], + scenarioTeam: [['pastor', 'Church planter', 'team-sipho'], ['kids', 'Kids', 'team-ayesha'], ['worship', 'Music', 'team-ruan'], ['prayer-coordinator', 'Prayer and community', 'team-lerato']], series: ['new-beginnings', 'New beginnings'], messages: [['why-church', 'Why church?', 4, 'Acts 2:42-47'], ['the-first-step', 'The first step', 11, 'Mark 1:16-20'], ['a-seat-at-the-table', 'A seat at the table', 18, 'Luke 14:15-24']], events: [ @@ -239,6 +257,7 @@ export const DEMO_SEEDS: Record = { ['home-groups', 'Home groups', 'Twelve groups across {city}, every Tuesday or Wednesday.'], ], leaders: [['Pastor Andile Zulu', 'Senior pastor'], ['Michelle de Beer', 'Children\'s pastor'], ['Kevin and Tracy Reddy', 'Home groups'], ['Lwazi Mthembu', 'Youth']], + scenarioTeam: [['pastor', 'Senior pastor', 'pastor-andile'], ['kids', 'Children\'s pastor', 'team-michelle'], ['prayer-coordinator', 'Prayer coordinator', 'team-lerato'], ['youth', 'Youth', 'team-johan']], series: ['family-matters', 'Family matters'], messages: [['love-at-home', 'Love at home', 3, '1 Corinthians 13'], ['raising-faith', 'Raising faith', 10, 'Deuteronomy 6:4-9'], ['better-together', 'Better together', 17, 'Ecclesiastes 4:9-12']], events: [ @@ -275,6 +294,7 @@ export const DEMO_SEEDS: Record = { ['outreach', 'Farm outreach', 'Visits, food parcels and prayer for farmworker families.'], ], leaders: [['Ds. Willem Coetzee', 'Minister'], ['Elsie Maritz', 'Sunday school'], ['Bongani Sithole', 'Farm outreach'], ['Marie Louw', 'Music']], + scenarioTeam: [['pastor', 'Minister', 'pastor-willem'], ['kids', 'Sunday school', 'team-elsie'], ['worship', 'Music', 'team-pieter'], ['prayer-coordinator', 'Prayer', 'team-marie']], series: ['seasons', 'Seasons'], messages: [['a-time-to-plant', 'A time to plant', 4, 'Ecclesiastes 3:1-8'], ['waiting-for-rain', 'Waiting for rain', 11, 'James 5:7-8'], ['the-harvest-is-plentiful', 'The harvest is plentiful', 18, 'Matthew 9:35-38']], events: [ @@ -311,6 +331,7 @@ export const DEMO_SEEDS: Record = { ['alpha', 'Alpha', 'Ten weeks, a meal and a conversation about life and faith.'], ], leaders: [['Daniel Joubert', 'Pastor'], ['Refilwe Mokoena', 'Kids'], ['Sam Abrahams', 'Music'], ['Nadia Govender', 'Alpha']], + scenarioTeam: [['pastor', 'Pastor', 'pastor-daniel'], ['kids', 'Kids', 'team-bongani'], ['worship', 'Music', 'team-nadia'], ['prayer-coordinator', 'Prayer', 'team-refilwe']], series: ['questions', 'Questions'], messages: [['why-suffering', 'Why is there suffering?', 3, 'Romans 8:18-28'], ['can-i-trust-the-bible', 'Can I trust the Bible?', 10, '2 Timothy 3:14-17'], ['who-is-jesus', 'Who is Jesus?', 17, 'Mark 8:27-30']], events: [ @@ -347,6 +368,7 @@ export const DEMO_SEEDS: Record = { ['international', 'International students', 'A welcome, a meal and help settling in.'], ], leaders: [['Dr Ian Mabaso', 'Pastor'], ['Lisa Roberts', 'Student worker'], ['Thabo Nkosi', 'Music'], ['Priya Singh', 'International students']], + scenarioTeam: [['pastor', 'Pastor', 'pastor-ian'], ['youth', 'Students', 'team-thabo'], ['worship', 'Music', 'team-lisa'], ['prayer-coordinator', 'Prayer', 'team-priya']], series: ['big-questions', 'Big questions'], messages: [['what-is-truth', 'What is truth?', 4, 'John 18:37-38'], ['does-god-care', 'Does God care?', 11, 'Psalm 139'], ['what-makes-a-good-life', 'What makes a good life?', 18, 'Micah 6:8']], events: [ @@ -360,4 +382,4 @@ export const DEMO_SEEDS: Record = { }; /** The profiles in the contracts' order (what the Hub offers). */ -export const demoSeeds = (): DemoSeed[] => agent.WEBSITE_DEMO_PROFILES.map((id: WebsiteDemoProfile) => DEMO_SEEDS[id]); +export const demoSeeds = (): ProfileSeed[] => agent.WEBSITE_DEMO_PROFILES.map((id: WebsiteDemoProfile) => DEMO_SEEDS[id]); diff --git a/apps/website/backend/tests/site.test.ts b/apps/website/backend/tests/site.test.ts index e5f233d..6929034 100644 --- a/apps/website/backend/tests/site.test.ts +++ b/apps/website/backend/tests/site.test.ts @@ -3,9 +3,13 @@ import assert from 'node:assert/strict'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; +import http from 'node:http'; +import type { AddressInfo } from 'node:net'; +import express from 'express'; import request from 'supertest'; -import { WEBSITE_TEMPLATES, agent } from '@crosscode/contracts'; -import { demoProfile, loadDemo, seedDesign } from '../src/demo/demoChurch.js'; +import { EVENT_FEED_SCHEMA, EVENT_SCHEMA, WEBSITE_TEMPLATES, agent } from '@crosscode/contracts'; +import { demoChurch, demoParts, demoPeople } from '@crosscode/demo'; +import { demoProfile, loadDemo, scenarioProfile, seedDesign } from '../src/demo/demoChurch.js'; import { DEMO_SEEDS, demoSeeds } from '../src/demo/seeds.js'; import { messageThumbnail, siteContent, spotifyEmbed, youtubeId } from '../src/site/content.js'; import { buildPalette, contrast, hexToRgb } from '../src/site/palette.js'; @@ -208,6 +212,82 @@ describe('the public site\'s content', () => { assert.ok(c.mode === 'published' && JSON.stringify(c.snapshot).includes('Welcome to Acacia Hill')); }); + for (const profile of agent.WEBSITE_DEMO_PROFILES) { + it(`1.8.0: the ${profile} scenario's people lead the ${profile} profile`, async () => { + const scenario = profile as agent.DemoScenarioKey; + const h = await harness({ linked: false }); + const dir = tmp(); + await h.ctx.settings.set('church_profile_local', JSON.stringify(scenarioProfile('http://x.test', scenario))); + await loadDemo(h.ctx, profile, { uploadDir: dir, scenario }); + const c = await siteContent(h.ctx); + assert.ok(c.mode === 'published'); + const seed = DEMO_SEEDS[profile]; + const parts = demoParts(scenario); + const leads = demoPeople(scenario).filter((p) => parts.has(p.email)); + const expected = seed.scenarioTeam.map(([part, role]) => [leads.find((p) => parts.get(p.email)!.includes(part))!.name, role]); + assert.deepEqual(c.snapshot.leaders.map((l) => [l.name, l.role]), expected, 'the scenario\'s people, the pastor first'); + assert.equal(new Set(expected.map(([name]) => name)).size, 4, 'four different people'); + for (const [i, l] of c.snapshot.leaders.entries()) assert.equal(l.photo?.alt, expected[i]![0], `${l.name}'s portrait is named for them`); + assert.ok(fs.existsSync(path.join(dir, 'demo', `${seed.scenarioTeam[0]![2]}.webp`)), 'the pastor\'s portrait chosen for them'); + const welcome = c.snapshot.pages[0]!.sections.find((s) => s.type === 'welcome')!.data as { pastor: { name: string; role: string } }; + assert.deepEqual([welcome.pastor.name, welcome.pastor.role], expected[0]); + for (const m of c.messages) assert.equal(m.speaker, expected[0]![0], 'the pastor preaches'); + const all = JSON.stringify(c.snapshot); + for (const [name] of seed.leaders) if (!expected.some(([n]) => n === name)) assert.ok(!all.includes(name), `none of the profile's own leaders (${name})`); + assert.equal(c.church?.name, demoChurch(scenario).profile.name); + assert.equal(c.events.length, 3, 'without Cross Events, the profile\'s own events'); + }); + } + + it('1.8.0: a scenario on a site with no church profile saves the scenario\'s church, not Acacia Hill', async () => { + const h = await harness({ linked: false }); + await loadDemo(h.ctx, 'bold-plant', { uploadDir: tmp(), scenario: 'bold-plant' }); + const c = await siteContent(h.ctx); + assert.equal(c.church?.name, demoChurch('bold-plant').profile.name); + assert.ok(c.mode === 'published' && !JSON.stringify(c.snapshot).includes('Acacia')); + }); + + it('1.8.0: a scenario loads only the profile of the same name', async () => { + const h = await harness({ linked: false }); + await assert.rejects(loadDemo(h.ctx, 'bold-plant', { uploadDir: tmp(), scenario: 'bold-youth' }), /bold-youth profile/); + assert.equal(await h.db.siteVersion.count(), 0, 'nothing changed'); + }); + + it('1.8.0: with Cross Events linked, a scenario shows Events\' events through the feed and makes none of its own', async () => { + const eventsId = '5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e'; + const start = new Date(Date.now() + 9 * 864e5); + const event = { + schema: EVENT_SCHEMA, id: '6c7d8e9f-0a1b-4c2d-8e3f-4a5b6c7d8e9f', origin: { product: 'events', installId: eventsId, url: 'https://events.ignite.test/events/conf' }, + status: 'published', updatedAt: new Date().toISOString(), title: 'Ignite youth conference', summary: null, description: null, imageUrl: null, timezone: 'Africa/Johannesburg', + startsAt: start.toISOString(), endsAt: new Date(start.getTime() + 3600e3).toISOString(), allDay: false, sessions: [], location: { name: 'The auditorium', address: null, onlineUrl: null }, + campus: null, series: null, tags: [], registration: { mode: 'origin', url: 'https://events.ignite.test/events/conf', status: 'open', opensAt: null, closesAt: null, priceFrom: null }, + }; + const fake = express(); + fake.get('/api/feed/v1/events', (_req, res) => { res.json({ schema: EVENT_FEED_SCHEMA, generatedAt: new Date().toISOString(), deleted: [], events: [event] }); }); + fake.post('/api/feed/v1/changed', (_req, res) => { res.status(202).json({ accepted: true }); }); + const server = http.createServer(fake); + await new Promise((r) => server.listen(0, '127.0.0.1', () => r())); + try { + const h = await harness({ linked: false, env: { LINKS_ALLOW_PRIVATE: 'true' } }); + const url = `http://127.0.0.1:${(server.address() as AddressInfo).port}`; + await h.db.productLink.create({ data: { installId: eventsId, product: 'events', url, publicKey: 'x', secret: h.ctx.secrets.encrypt('events-link-secret-0123456789abcdef'), connectedAt: new Date(), showEvents: false } }); + const version = await loadDemo(h.ctx, 'bold-youth', { uploadDir: tmp(), scenario: 'bold-youth' }); + assert.equal(version.eventsSync?.ok, true, version.eventsSync?.error); + assert.equal(await h.db.simpleEvent.count(), 0, 'no events of its own'); + assert.equal((await h.db.productLink.findUnique({ where: { installId: eventsId } }))?.showEvents, true, 'Show events from Cross Events'); + const c = await siteContent(h.ctx); + assert.ok(c.mode === 'published'); + assert.deepEqual(c.events.map((e) => [e.title, e.from]), [['Ignite youth conference', 'events']]); + assert.equal(await h.db.mediaAsset.count(), 16, 'no pictures for events it doesn\'t make'); + + // A single profile load (no scenario) still makes its own, as before. + await loadDemo(h.ctx, 'bold-youth', { uploadDir: tmp() }); + assert.equal(await h.db.simpleEvent.count(), 3); + } finally { + await new Promise((r) => server.close(r)); + } + }); + it('serves the uploads, never a folder or outside it, and the content over HTTP', async () => { const dir = tmp(); const h = await harness({ linked: false, env: { UPLOAD_DIR: dir } }); diff --git a/apps/website/frontend/package.json b/apps/website/frontend/package.json index d3e182c..091a975 100644 --- a/apps/website/frontend/package.json +++ b/apps/website/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/website-frontend", - "version": "1.7.1", + "version": "1.8.0", "private": true, "description": "Church Website: the church's public site in its template, and the admin", "scripts": { diff --git a/docs/APP-1.0-PLAN.md b/docs/APP-1.0-PLAN.md index c5af0a0..a4dd7dd 100644 --- a/docs/APP-1.0-PLAN.md +++ b/docs/APP-1.0-PLAN.md @@ -29,11 +29,11 @@ links with the Website and Cross Events, so the three feel like one church. **Where things stand:** every earlier phase is released and rolled out, including the Church Website at Hope Family Church and a second church (confirmed by Joshua 2026-11-30). **Phase 6 progress -(2026-11-30):** `contracts@1.20.0`, `1.21.0` and `1.22.0`, `accounts@1.9.0` and `events@3.8.0` released -(not deployed yet), with the new shared package `@crosscode/demo` 1.1.0 (§12, "Demo scenarios"). +(2026-11-30):** `contracts@1.20.0`, `1.21.0` and `1.22.0`, `accounts@1.9.0`, `events@3.8.0` and `website@1.8.0` +released (not deployed yet), with the new shared package `@crosscode/demo` 1.1.0 (§12, "Demo scenarios"). The Bible publishers' terms were checked ([BIBLE-PERMISSIONS.md](./BIBLE-PERMISSIONS.md)): 1.0 uses only the free translations, the KJV and the Berean Standard Bible (decision 14, contracts 1.22.0). -Next: `website@1.8.0`, `agent@1.7.0`, Hub `v2.26.0`, then `app@1.0.0` (§15). +Next: `agent@1.7.0`, Hub `v2.26.0`, then `app@1.0.0` (§15). **Who uses 1.0:** the demo church (cross-demo2, Acacia Hill) first, then Hope Family Church. Then it goes on sale (crosscode-site, ROADMAP §9). @@ -41,7 +41,7 @@ it goes on sale (crosscode-site, ROADMAP §9). **Done when:** - `app@1.0.0`, `contracts@1.20.0` (released 2026-11-30), `contracts@1.21.0` (released 2026-11-30), `contracts@1.22.0` (released 2026-11-30), `accounts@1.9.0` - (released 2026-11-30), `events@3.8.0` (released 2026-11-30), `website@1.8.0`, `agent@1.7.0` and Hub `v2.26.0` are tagged; the Hub installs + (released 2026-11-30), `events@3.8.0` (released 2026-11-30), `website@1.8.0` (released 2026-11-30), `agent@1.7.0` and Hub `v2.26.0` are tagged; the Hub installs the App from New install (after Accounts) and lists its releases. - On a demo client, **Load a demo scenario** in the Hub loads Accounts, Events, the Website and the App with the same church, people and events, in one step (§12, "Demo scenarios"). @@ -545,7 +545,7 @@ data that describes **the same church**, so a demo shows the three products work | `crosscode-platform` `packages/contracts` | The free translations only in 1.0 (`licence`, `FREE_BIBLE_TRANSLATION_IDS`, the CSV `translations` option), the Berean Standard Bible (`BSB`) added; the publishers' exact notices (`copyright`, `acknowledgement`, the Bible Society's `disclaimer`), `publisher` and `permissionsUrl`, `FREE_QUOTE_VERSES`, `quotedVerses`; `AFR83` named "Afrikaans 1983/1992-vertaling" | `contracts@1.22.0` (**released 2026-11-30**) | | `crosscode-platform` `apps/accounts` | `messaging.get` for linked products, a hint when the messaging settings change, the WhatsApp opt-out for every product; demo data (the scenario's church profile with its logo and icon, and its people) | `accounts@1.9.0` (**released 2026-11-30**) | | `crosscode-platform` `apps/events` | STOP stops all WhatsApp, passed to Accounts; the opt-out read from Accounts; a demo profile per scenario (its four kept) | `events@3.8.0` (**released 2026-11-30**) | -| `crosscode-platform` `apps/website` | Demo profiles take the scenario's people and events (`--scenario`) | `website@1.8.0` | +| `crosscode-platform` `apps/website` | Demo profiles take the scenario's people and events (`--scenario`) | `website@1.8.0` (**released 2026-11-30**) | | `crosscode-platform` `apps/agent` | `seed-demo` for `app` and `accounts`, `--scenario` passed on | `agent@1.7.0` | | `crosscode-platform` `packages/demo` | New: the scenarios' churches, people (`gender` from 1.1.0) and SVG logos | `@crosscode/demo` 1.1.0 (workspace, **released with Accounts 1.9.0 / Events 3.8.0**) | | `crosscode-platform` `packages/ui` | The tab bar and bottom sheet, if worth sharing; otherwise nothing | workspace | @@ -591,7 +591,7 @@ data that describes **the same church**, so a demo shows the three products work WhatsApp opt-out) and `events@3.8.0` (STOP passed to Accounts), **both released 2026-11-30**, rolled out to every church (not yet). 2. `contracts@1.21.0` (demo scenarios, **released 2026-11-30**), with the scenario demo loaders in Accounts 1.9.0, Events - 3.8.0, `website@1.8.0`, and `agent@1.7.0`. + 3.8.0, `website@1.8.0` (**released 2026-11-30**), and `agent@1.7.0`. 3. Hub `v2.26.0` (vendored contracts 1.22.0) deployed, and the first 3 months of Cross Code devotionals written or imported, in the KJV or BSB (decision 14). 4. `app@1.0.0` tagged after the e2e and Lighthouse runs. diff --git a/docs/HANDOVER.md b/docs/HANDOVER.md index c4a3c51..8fd6cfa 100644 --- a/docs/HANDOVER.md +++ b/docs/HANDOVER.md @@ -34,13 +34,13 @@ every release). | 3 | Accounts 1.0.0 | **Released, rolled out and tested** (`accounts@1.8.0` rolled out; `1.9.0` released 2026-11-30 for phase 6, not deployed; [ACCOUNTS-1.0-PLAN.md](./ACCOUNTS-1.0-PLAN.md)) | | 4 | Cross Events 3.0.0: sign-in through Accounts | **Released, rolled out and tested** (`events@3.7.2` rolled out; `3.8.0` released 2026-11-30 for phase 6, not deployed; [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md)). Churches sign in through their Accounts; crosscode-site `v1.6.0` deployed | | 4+ | Running it: jobs from the dashboard, styled emails, .env from the Hub, sign-in health, the nightly people check; then frp config and one-product uninstalls, and the Hub's popups, pickers and port list | **Released, deployed and tested** 2026-11-20 and 2026-11-23 (below) | -| 5 | Church Website 1.0.0 | **Released 2026-11-26** (planned 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md), all decisions confirmed). Font pairings confirmed 2026-11-24, section variants per template 2026-11-25 (§3). `contracts@1.17.0`, `accounts@1.7.0` and `events@3.7.0` released 2026-11-24, Hub `v2.21.0` 2026-11-25 (the Hub deployed 2026-11-25; the others not rolled out yet). `contracts@1.18.0` and Hub `v2.22.0` (Get more storage) released 2026-11-25, the Hub deployed 2026-11-26. **`website@1.0.0` and `1.0.1` released 2026-11-26**, crosscode-site `v1.7.0` (the Website on sale) released 2026-11-26. **Done** (confirmed by Joshua 2026-11-30): crosscode-site deployed, Hope Family Church and a second church live, the remaining release checks finished. Now `website@1.7.1` (VERSIONS.md) | -| 6 | Church App 1.0.0 | **Under way** (planned and started 2026-11-30): [APP-1.0-PLAN.md](./APP-1.0-PLAN.md), decisions confirmed 2026-11-30 (decision 13, the demo scenarios, added the same day); mockup on the Design canvas "Church App 1.0 mockup". Released 2026-11-30, not deployed: `contracts@1.20.0`, `1.21.0` and `1.22.0`, `accounts@1.9.0`, `events@3.8.0` (below). Next: Website 1.8.0, agent 1.7.0, Hub 2.26.0, `app@1.0.0` | +| 5 | Church Website 1.0.0 | **Released 2026-11-26** (planned 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md), all decisions confirmed). Font pairings confirmed 2026-11-24, section variants per template 2026-11-25 (§3). `contracts@1.17.0`, `accounts@1.7.0` and `events@3.7.0` released 2026-11-24, Hub `v2.21.0` 2026-11-25 (the Hub deployed 2026-11-25; the others not rolled out yet). `contracts@1.18.0` and Hub `v2.22.0` (Get more storage) released 2026-11-25, the Hub deployed 2026-11-26. **`website@1.0.0` and `1.0.1` released 2026-11-26**, crosscode-site `v1.7.0` (the Website on sale) released 2026-11-26. **Done** (confirmed by Joshua 2026-11-30): crosscode-site deployed, Hope Family Church and a second church live, the remaining release checks finished. Now `website@1.8.0` (VERSIONS.md) | +| 6 | Church App 1.0.0 | **Under way** (planned and started 2026-11-30): [APP-1.0-PLAN.md](./APP-1.0-PLAN.md), decisions confirmed 2026-11-30 (decision 13, the demo scenarios, added the same day); mockup on the Design canvas "Church App 1.0 mockup". Released 2026-11-30, not deployed: `contracts@1.20.0`, `1.21.0` and `1.22.0`, `accounts@1.9.0`, `events@3.8.0`, `website@1.8.0` (below). Next: agent 1.7.0, Hub 2.26.0, `app@1.0.0` | | 7 | App 1.x | Not started | ## Released 2026-11-30 (phase 6, first steps) -Tagged and pushed on 2026-11-30, **not deployed yet** (each app has one migration). Details in +Tagged and pushed on 2026-11-30, **not deployed yet** (Accounts and Events have one migration each; the Website none). Details in [VERSIONS.md](./VERSIONS.md), [CHANGELOG.md](../CHANGELOG.md) and the apps' CHANGELOGs. | Release | What | @@ -50,6 +50,7 @@ Tagged and pushed on 2026-11-30, **not deployed yet** (each app has one migratio | `accounts@1.9.0`, `@crosscode/demo` 1.0.0 | `messaging.get` for the App; the WhatsApp opt-out for every product (STOP kept per number and account, Accounts' own WAWP webhook, "Turn WhatsApp back on"); a scenario's church profile, SVG logo and icon, and people (`crosscode demo accounts --profile `) | | `contracts@1.22.0` | Only free Bible translations in 1.0 (KJV and the new BSB: `licence`, `FREE_BIBLE_TRANSLATION_IDS`, the CSV `translations` option); the publishers' exact notices (NLT, ESV and the Afrikaans ones were out of date), the Bible Society's disclaimer, an `acknowledgement` per translation, who to ask, `FREE_QUOTE_VERSES` and `quotedVerses` ([BIBLE-PERMISSIONS.md](./BIBLE-PERMISSIONS.md)) | | `events@3.8.0`, `@crosscode/demo` 1.1.0 | STOP stops all WhatsApp (not only news), checked before every message and passed on to Accounts; the eight scenarios as Events demo profiles, around each church's own people and campuses | +| `website@1.8.0` | A profile loaded with `--scenario` takes the scenario's people as its leaders and, with a linked Cross Events, shows Events' events through the feed instead of its own; `crosscode demo website --scenario`; `packages/demo` built with the Website. No migration | All four were checked on PostgreSQL 18 (local, details in `temp/`, never committed): migrations, scenario loads, the opt-out. @@ -118,41 +119,14 @@ Joshua 2026-11-30; VERSIONS.md, "Deployed / rolled out"). 1. **Phase 6, Church App 1.0.0** (ROADMAP §7, §9), [APP-1.0-PLAN.md](./APP-1.0-PLAN.md) §15. **Done 2026-11-30 (released, not deployed):** contracts 1.20.0, 1.21.0 and 1.22.0, Accounts - 1.9.0, Events 3.8.0. The Bible publishers' terms checked: none covers a sold app, so **1.0 uses only the + 1.9.0, Events 3.8.0, Website 1.8.0. The Bible publishers' terms checked: none covers a sold app, so **1.0 uses only the free translations, the KJV and the Berean Standard Bible** (APP-1.0-PLAN decision 14); the permission requests for the others are drafted in [BIBLE-PERMISSIONS.md](./BIBLE-PERMISSIONS.md) for later, and nothing waits for them. **Next:** - 1. **Website 1.8.0:** its eight demo profiles take each scenario church's people (leaders, - pastor) from `@crosscode/demo` and accept `--scenario`; the Website builds `packages/demo`. - Not started (no branch). Worked out on 2026-11-30, to build on `feat/website-1.8`: - - `npm run demo -- --profile

--scenario

` (`backend/scripts/demo.ts`); `loadDemo(ctx, - profile, { scenario })` in `src/demo/demoChurch.ts`; the scenario must be the profile. - - **Leaders:** a `scenarioTeam` per seed in `src/demo/seeds.ts`, four `[part, role, photo]`, - the pastor first, the names from `demoPeople(scenario)` by part. Portraits by gender - (keys in `demo-photos/photos.json`), checked 2026-11-30: - heritage-parish pastor/Rector pastor-margaret, worship/Director of music team-sipho, - kids/Sunday school team-anne, prayer-coordinator team-david; heritage-city pastor/Vicar - pastor-peter, prayer-coordinator team-claire, worship/Organist team-nomsa, youth/Students - and young adults team-tom; bold-youth pastor/Lead pastor team-kagiso, youth/Youth pastor - team-ayesha, worship/Worship pastor team-megan, prayer-coordinator/Prayer and connect - groups team-ruan; bold-plant pastor/Church planter team-sipho, kids team-ayesha, worship/Music - team-ruan, prayer-coordinator/Prayer and community team-lerato; community-family - pastor/Senior pastor pastor-andile, kids/Children's pastor team-michelle, prayer-coordinator - team-lerato, youth team-johan; community-town pastor/Minister pastor-willem, kids/Sunday - school team-elsie, worship/Music team-pieter, prayer-coordinator/Prayer team-marie; - clean-modern pastor pastor-daniel, kids team-bongani, worship/Music team-nadia, - prayer-coordinator/Prayer team-refilwe; clean-campus pastor pastor-ian, youth/Students - team-thabo, worship/Music team-lisa, prayer-coordinator/Prayer team-priya. The pastor is - the messages' speaker; photo alt texts carry the new names (as now). - - **Events:** with a linked Cross Events (`ProductLink`, product `events`), a scenario load - makes no simple events of its own, sets that link's `showEvents` and runs `syncLink`, so - Events' events show through the feed, never copied (APP-1.0-PLAN §12). Without Events, its - own three as now. - - **Script:** `cmd_demo_website` in `scripts/lib/manage.sh` passes `--scenario`; - `website_shared_packages` and `website_build` in `scripts/products/website.sh` add - `packages/demo` (as `events.sh` does); `@crosscode/demo` in the backend's package.json. - - Tests in `backend/tests/site.test.ts`: each scenario's leaders are its people, none of the - seed's own leader names left, events from the feed when Events is linked. + 1. ~~**Website 1.8.0**~~: **released 2026-11-30** (not deployed). A profile loaded with + `--scenario` takes the scenario's people as leaders (`scenarioTeam` in `src/demo/seeds.ts`) + and, with a linked Cross Events, shows Events' events through the feed; `crosscode demo + website --scenario`; the Website builds `packages/demo`. 2. **Agent 1.7.0:** `seed-demo` for `app` and `accounts`, `--scenario` passed on (`SEED_SCENARIO_MIN_AGENT`; bump `AGENT_VERSION` too). 3. **Hub 2.26.0** (vendored contracts 1.22.0): the App in New install and releases, billing on @@ -162,7 +136,7 @@ Joshua 2026-11-30; VERSIONS.md, "Deployed / rolled out"). months of Cross Code devotionals. 4. **`app@1.0.0`** → cross-demo2 (every scenario loaded, the throwaway install from the Hub) → Hope Family Church → crosscode-site 1.10.0 (the App on sale). - Deploying Accounts 1.9.0 and Events 3.8.0 to the churches can happen any time before the App; + Deploying Accounts 1.9.0, Events 3.8.0 and Website 1.8.0 to the churches can happen any time before the App; a church without Cross Events gives WAWP the address in Accounts → Admin → Email and WhatsApp. Done (confirmed by Joshua 2026-11-25): `hope-events` is archived, and every FastPanel site set up before Hub 2.10.0, and the Hub's own site, has `location ^~ /api/`. diff --git a/docs/VERSIONS.md b/docs/VERSIONS.md index 1550a6c..75d68d0 100644 --- a/docs/VERSIONS.md +++ b/docs/VERSIONS.md @@ -11,13 +11,13 @@ separately below; the two often differ. | What | Repo | Latest | Tag | Released | |------|------|--------|-----|----------| | Cross Events | `crosscode-platform` (`apps/events`) | **3.8.0** | `events@3.8.0` | 2026-11-30 | -| Church Website | `crosscode-platform` (`apps/website`) | **1.7.1** | `website@1.7.1` | 2026-11-28 | +| Church Website | `crosscode-platform` (`apps/website`) | **1.8.0** | `website@1.8.0` | 2026-11-30 | | Accounts | `crosscode-platform` (`apps/accounts`) | **1.9.0** | `accounts@1.9.0` | 2026-11-30 | | Server agent | `crosscode-platform` (`apps/agent`) | **1.6.0** | `agent@1.6.0` | 2026-11-27 | | Contracts | `crosscode-platform` (`packages/contracts`) | **1.22.0** | `contracts@1.22.0` | 2026-11-30 | | Cross Code Hub | `events-hub` | **2.25.1** | `v2.25.1` | 2026-11-27 | | crosscode.co.za | `crosscode-site` | **1.9.1** | `v1.9.1` | 2026-11-27 | -| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-30 (last change: Events takes the demo scenarios as profiles, `crosscode demo accounts`, `--scenario` on every demo, Accounts and Events build `packages/demo`) | +| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-30 (last change: `--scenario` passed on to the Website's demo, the Website builds `packages/demo`; before that Events takes the demo scenarios as profiles, `crosscode demo accounts`, Accounts and Events build `packages/demo`) | The `crosscode` script has no version: every server's copy (`/opt/crosscode/tools`) pulls `main` on each run, so merging to `main` and pushing releases it. Its changes are listed in @@ -28,7 +28,7 @@ on each run, so merging to `main` and pushing releases it. Its changes are liste | What | Where | Version in package.json | |------|-------|-------------------------| | `@crosscode/auth-client` | `packages/auth-client` | 1.1.0 (released with Events 3.0.0 and Accounts 1.1.0) | -| `@crosscode/demo` | `packages/demo` | 1.1.0 (the demo scenarios' churches, people and logos; ships with Accounts 1.9.0 and Events 3.8.0) | +| `@crosscode/demo` | `packages/demo` | 1.1.0 (the demo scenarios' churches, people and logos; ships with Accounts 1.9.0, Events 3.8.0 and Website 1.8.0) | | `@crosscode/seo` | `packages/seo` | 1.0.0 (released with Events 2.4.0) | | `@crosscode/ui` | `packages/ui` | 0.3.0 (fonts, `ChurchFooter`; 0.2.0 with Accounts 1.7.0, 0.3.0 with Events 3.7.0) | | Website | `apps/website` | 1.7.1 (1.0.0–1.1.0 released 2026-11-26, 1.2.0–1.7.0 on 2026-11-27, 1.7.1 on 2026-11-28; installed for the demo church cross-demo2 (1.7.1) only, Hope Family Church next) | @@ -39,6 +39,14 @@ need their own tags until something outside this repo depends on them. ## What each latest release was for +- **Church Website 1.8.0 + crosscode script (2026-11-30):** demo scenarios (APP-1.0-PLAN §12): a + profile loaded with `--scenario` takes the scenario's people as its leaders (the pastor first, + each with a portrait chosen for them) and, with a linked Cross Events, shows Events' events + through the feed instead of making its own. `crosscode demo website --scenario`; the + Website builds `packages/demo`. **No migration.** Checked: the Website's backend tests (147), the + script's bats (demo and website), `npm run check`, and on PostgreSQL 18 scenario and profile loads + (with an unreachable Events link too: the load succeeds and says the feed will catch up). Not + deployed yet. - **Contracts 1.22.0 (2026-11-30):** only free Bible translations in App 1.0 (KJV and the new Berean Standard Bible, `licence`, `FREE_BIBLE_TRANSLATION_IDS`, the CSV import's `translations`); the Bible publishers' exact notices for the Church App's diff --git a/package-lock.json b/package-lock.json index c59a419..23ebe91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -362,11 +362,12 @@ }, "apps/website/backend": { "name": "@crosscode/website-backend", - "version": "1.7.1", + "version": "1.8.0", "hasInstallScript": true, "dependencies": { "@crosscode/auth-client": "*", "@crosscode/contracts": "*", + "@crosscode/demo": "*", "@prisma/adapter-pg": "^7.10.1", "@prisma/client": "^7.10.1", "cron-parser": "^5.10.2", @@ -391,7 +392,7 @@ }, "apps/website/frontend": { "name": "@crosscode/website-frontend", - "version": "1.7.1", + "version": "1.8.0", "dependencies": { "@crosscode/contracts": "*", "@crosscode/seo": "*", diff --git a/scripts/lib/manage.sh b/scripts/lib/manage.sh index 25480fb..b1829ed 100644 --- a/scripts/lib/manage.sh +++ b/scripts/lib/manage.sh @@ -11,12 +11,14 @@ crosscode demo --profile [--admin-email ] (small, events, ministry, multicampus, or from 3.8.0 a demo scenario's church); a backup is taken first, one admin account is kept -crosscode demo website --profile +crosscode demo website --profile [--scenario ] replace the Website's content with a demo church (heritage-parish, heritage-city, bold-youth, bold-plant, community-family, community-town, clean-modern, clean-campus); a backup is taken - first; the church's profile, settings and admins stay + first; the church's profile, settings and admins stay; + from 1.8.0, --scenario: the scenario's people lead, + and a linked Cross Events' events show instead crosscode demo accounts --profile [--scenario ] a demo scenario's church (profile, logo, icon) and people in Accounts (the eight scenarios, as the @@ -136,7 +138,7 @@ cmd_demo() { if [ "$product" = website ]; then [[ " $WEBSITE_DEMO_PROFILES " == *" $profile "* ]] || die "--profile: one of $WEBSITE_DEMO_PROFILES." [ -z "$email" ] || die "--admin-email: the Website's demo keeps every admin." - cmd_demo_website "$church" "$profile" + cmd_demo_website "$church" "$profile" "$scenario" return fi [[ " $DEMO_PROFILES " == *" $profile "* ]] || die "--profile: one of $DEMO_PROFILES." @@ -201,7 +203,8 @@ cmd_demo_accounts() { # the eight demo churches, keeping the church's profile, the site settings and the admins. Backup # first; then reloaded, so nothing cached from before is shown. cmd_demo_website() { - local church="$1" profile="$2" dir user app + local church="$1" profile="$2" scenario="${3:-}" dir user app + local -a scenario_args=() require_root load_church "$church" church_has_product website || die "$church has no Church Website." @@ -211,12 +214,18 @@ cmd_demo_website() { user="$(pvar website USER)" app="$(website_app "$dir")" [ -f "$app/backend/src/demo/seeds.ts" ] || die "This release of the Website ($(checkout_ref "$dir" website)) has no demo profiles (1.3.0 or later has)." + if [ -n "$scenario" ]; then + # 1.8.0: the scenario's people lead, and Cross Events' events show through the feed. + grep -q scenarioTeam "$app/backend/src/demo/seeds.ts" || + die "This release of the Website ($(checkout_ref "$dir" website)) has no demo scenarios (1.8.0 or later has)." + scenario_args=(--scenario "$scenario") + fi step "Website: backup first" website_backup "$dir" "$user" || die "The backup failed, so the demo wasn't loaded." step "Website: demo ($profile)" - run_as "$user" "$app/backend" npm run --silent demo -- --profile "$profile" --force || + run_as "$user" "$app/backend" npm run --silent demo -- --profile "$profile" "${scenario_args[@]+"${scenario_args[@]}"}" --force || die "The demo wasn't loaded (see above). If it got as far as changing anything, the backup from just now has the content from before." step "Website: reloading PM2" diff --git a/scripts/products/website.sh b/scripts/products/website.sh index 798445c..b67e5e2 100644 --- a/scripts/products/website.sh +++ b/scripts/products/website.sh @@ -17,10 +17,11 @@ website_expected_version() { node -p 'require(process.argv[1]).version' "$(website_app "$1")/backend/package.json" } -# The shared packages the Website is built with (contracts, auth-client for signing in, ui and seo for its pages). +# The shared packages the Website is built with (contracts, auth-client for signing in, ui and seo for its pages, +# 1.8.0: demo for the demo scenarios). website_shared_packages() { local p - for p in packages/contracts packages/ui packages/auth-client packages/seo; do + for p in packages/contracts packages/ui packages/auth-client packages/seo packages/demo; do [ -f "$1/$p/package.json" ] && printf '%s\n' "$p" done } @@ -54,7 +55,7 @@ website_migrate() { website_build() { local p - for p in packages/contracts packages/auth-client packages/seo; do + for p in packages/contracts packages/auth-client packages/seo packages/demo; do [ ! -f "$1/$p/package.json" ] || run_as "$2" "$1/$p" npm run build || return 1 done run_as "$2" "$(website_app "$1")/backend" npm run build && diff --git a/scripts/tests/demo.bats b/scripts/tests/demo.bats index 4bce6a3..96447a9 100644 --- a/scripts/tests/demo.bats +++ b/scripts/tests/demo.bats @@ -18,7 +18,7 @@ setup() { mkdir -p "$CROSSCODE_HOME/products" "$TMP/sites/hope/events/apps/events/backend/scripts" touch "$TMP/sites/hope/events/apps/events/backend/scripts/set-demo.js" mkdir -p "$TMP/sites/hope/website/apps/website/backend/src/demo" - touch "$TMP/sites/hope/website/apps/website/backend/src/demo/seeds.ts" + echo "scenarioTeam" > "$TMP/sites/hope/website/apps/website/backend/src/demo/seeds.ts" mkdir -p "$TMP/sites/hope/accounts/apps/accounts/backend/scripts" touch "$TMP/sites/hope/accounts/apps/accounts/backend/scripts/demo.ts" cat > "$CROSSCODE_HOME/products/accounts.sh" < "$CALLS" + : > "$TMP/sites/hope/website/apps/website/backend/src/demo/seeds.ts" + run cmd_demo hope website --profile bold-youth --scenario bold-youth + [ "$status" -eq 1 ] + [[ "$output" == *"no demo scenarios"* ]] + [ ! -s "$CALLS" ] + run cmd_demo hope website --profile bold-youth + [ "$status" -eq 0 ] + [[ "$(cat "$CALLS")" == *"demo -- --profile bold-youth --force"* ]] +} + @test "a failed Accounts demo isn't followed by a reload" { FAIL_SEED=1 run cmd_demo hope accounts --profile clean-modern [ "$status" -eq 1 ] diff --git a/scripts/tests/website.bats b/scripts/tests/website.bats index 2a520b4..2405e4b 100644 --- a/scripts/tests/website.bats +++ b/scripts/tests/website.bats @@ -48,6 +48,17 @@ checkout() { [ "$(cut -d'|' -f2 "$CALLS" | tr '\n' ' ')" = "new/packages/contracts new/packages/auth-client new/packages/seo new/apps/website/backend new/apps/website/frontend " ] } +@test "1.8.0: demo is installed and built too (after contracts), where the release has it" { + checkout new + mkdir -p "$TMP/new/packages/demo" + echo '{"name":"@crosscode/demo"}' > "$TMP/new/packages/demo/package.json" + website_install_deps "$TMP/new" hope + grep -qx 'hope|new|npm ci --include=dev --no-audit --no-fund --include-workspace-root -w packages/contracts -w packages/ui -w packages/auth-client -w packages/seo -w packages/demo -w apps/website/backend -w apps/website/frontend' "$CALLS" + : > "$CALLS" + website_build "$TMP/new" hope + [ "$(cut -d'|' -f2 "$CALLS" | tr '\n' ' ')" = "new/packages/contracts new/packages/auth-client new/packages/seo new/packages/demo new/apps/website/backend new/apps/website/frontend " ] +} + @test "ports default to 5300 / 3300, else church.env's" { [ "$(website_api_port)" = 5300 ] [ "$(website_web_port)" = 3300 ]