Website 1.3.0, agent 1.6.0, contracts 1.19.0: demo data for the Church Website
Eight demo churches, two per template (the second on the template's other recommended variants and header), loaded from the Hub on demo sites with `crosscode demo <church> website --profile <p>`. A profile replaces the content only: the church's profile from Accounts, the site settings, the site icon and the admins stay, and the copy names the church. - contracts: WEBSITE_DEMO_PROFILES, DEMO_PRODUCTS, SEED_WEBSITE_DEMO_MIN_AGENT; seed-demo takes an optional product (events by default) - agent: a Website seed-demo job runs `crosscode demo <church> website` - crosscode script: backup, demo as the site's user, reload, health check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,9 +59,33 @@ export const DEMO_PROFILES = ["small", "events", "ministry", "multicampus"] as c
|
||||
export const demoProfileSchema = z.enum(DEMO_PROFILES);
|
||||
export type DemoProfile = z.infer<typeof demoProfileSchema>;
|
||||
|
||||
/**
|
||||
* The Church Website's demo data sets (1.19.0, `apps/website/backend/src/demo/seeds.ts`): two per
|
||||
* template, each its own kind of church, the second on the template's other recommended variants.
|
||||
*/
|
||||
export const WEBSITE_DEMO_PROFILES = [
|
||||
"heritage-parish", "heritage-city",
|
||||
"bold-youth", "bold-plant",
|
||||
"community-family", "community-town",
|
||||
"clean-modern", "clean-campus",
|
||||
] as const;
|
||||
export const websiteDemoProfileSchema = z.enum(WEBSITE_DEMO_PROFILES);
|
||||
export type WebsiteDemoProfile = z.infer<typeof websiteDemoProfileSchema>;
|
||||
|
||||
/** The products with demo data (`seed-demo` jobs). */
|
||||
export const DEMO_PRODUCTS = ["events", "website"] as const;
|
||||
export const demoProductSchema = z.enum(DEMO_PRODUCTS);
|
||||
export type DemoProduct = z.infer<typeof demoProductSchema>;
|
||||
|
||||
/** Each demo product's profiles. */
|
||||
export const DEMO_PROFILES_BY_PRODUCT: Record<DemoProduct, readonly string[]> = { events: DEMO_PROFILES, website: WEBSITE_DEMO_PROFILES };
|
||||
|
||||
/** The first agent that runs `seed-demo` jobs (an older one refuses the unknown type). */
|
||||
export const SEED_DEMO_MIN_AGENT = "1.2.0";
|
||||
|
||||
/** The first agent that runs `seed-demo` jobs for the Website (`product: "website"`; an older one refuses the unknown key). */
|
||||
export const SEED_WEBSITE_DEMO_MIN_AGENT = "1.6.0";
|
||||
|
||||
/** The first agent that runs `env-read` and `env-set` jobs (an older one refuses the unknown types). */
|
||||
export const ENV_JOBS_MIN_AGENT = "1.3.0";
|
||||
|
||||
@@ -135,11 +159,22 @@ export const jobArgsSchemas = {
|
||||
/** `crosscode restart <church> [product] --json` (PM2 reload) */
|
||||
restart: z.strictObject({ church: shortNameSchema, product: productSchema.optional() }),
|
||||
/**
|
||||
* `crosscode demo <church> --profile <profile> [--admin-email <email>] --json`: replaces Cross
|
||||
* Events' data with a demo set (a backup is taken first). The Hub only makes it for installs
|
||||
* marked as demo sites. `adminEmail`: the account kept (default: the release's own choice).
|
||||
* `crosscode demo <church> [website] --profile <profile> [--admin-email <email>] --json`: replaces
|
||||
* Cross Events' data (or, 1.19.0 with `product: "website"`, the Website's content) with a demo
|
||||
* set (a backup is taken first). The Hub only makes it for installs marked as demo sites.
|
||||
* `adminEmail` (Events only): the account kept (default: the release's own choice). No `product`
|
||||
* is Events, so older Hubs' jobs mean what they did.
|
||||
*/
|
||||
"seed-demo": z.strictObject({ church: shortNameSchema, profile: demoProfileSchema, adminEmail: z.email().max(254).optional() }),
|
||||
"seed-demo": z.strictObject({
|
||||
church: shortNameSchema,
|
||||
product: demoProductSchema.optional(),
|
||||
profile: z.union([demoProfileSchema, websiteDemoProfileSchema]),
|
||||
adminEmail: z.email().max(254).optional(),
|
||||
}).superRefine((a, ctx) => {
|
||||
const product = a.product ?? "events";
|
||||
if (!DEMO_PROFILES_BY_PRODUCT[product].includes(a.profile)) ctx.addIssue({ code: "custom", path: ["profile"], message: `${a.profile} isn't a ${product} demo` });
|
||||
if (product === "website" && a.adminEmail) ctx.addIssue({ code: "custom", path: ["adminEmail"], message: "the Website's demo keeps every admin" });
|
||||
}),
|
||||
/**
|
||||
* `crosscode env <church> <product> --json`: the product's .env values, secrets hidden (only
|
||||
* whether they're set). The report's `result` is an {@link envReadResultSchema}.
|
||||
|
||||
Reference in New Issue
Block a user