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
+14 -5
View File
@@ -11,12 +11,14 @@ crosscode demo <church> --profile <profile> [--admin-email <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 <church> website --profile <profile>
crosscode demo <church> website --profile <profile> [--scenario <profile>]
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 <church> accounts --profile <scenario> [--scenario <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"
+4 -3
View File
@@ -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 &&
+16 -1
View File
@@ -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" <<EOF3
@@ -156,6 +156,21 @@ wait 1.9.0" ]
[ "$status" -eq 0 ]
}
@test "website 1.8.0: --scenario is passed on, and only to a release that has scenarios" {
run cmd_demo hope website --profile bold-youth --scenario bold-youth
[ "$status" -eq 0 ]
[[ "$(cat "$CALLS")" == *"npm run --silent demo -- --profile bold-youth --scenario bold-youth --force"* ]]
: > "$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 ]
+11
View File
@@ -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 ]