Events 2.4.0 frontend, deploy and docs: Linked products, linked events, seo
- Site settings → Linked products (Connect, Show events from, Publish my events), help, command palette. - Events from linked products on /events, the home and campus pages, and /events/linked/<product>/<id> (markdown with HTML off, canonical to the origin, no JSON-LD, not in the sitemap). - Event page JSON-LD from @crosscode/seo; lib/eventSchema.ts removed. - Readiness check for linked products' sync; e2e spec with a fake Church Website (not run yet: needs the e2e Postgres). - crosscode: install and build the shared packages Events uses first (an older tag still builds as before); scripts/tests/events.bats. - Release notes, changelogs, handovers, hub-protocol.md, and the plan's "Changes while building". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,10 +31,27 @@ events_backup() {
|
||||
.catch(e => { console.error(" Backup failed: " + e.message); process.exit(1); });'
|
||||
}
|
||||
|
||||
# Only this app's workspaces, never the other products'. --include=dev: the TypeScript and Next
|
||||
# builds need type and build packages even where NODE_ENV=production.
|
||||
# The shared packages this checkout's Events uses (from 2.4.0: contracts and seo), built before it.
|
||||
# Only the ones in the checkout, so going back to an older tag still installs and builds.
|
||||
events_shared_packages() {
|
||||
local p
|
||||
for p in packages/contracts packages/seo; do
|
||||
if [ -f "$1/$p/package.json" ] && grep -q "\"@crosscode/${p#packages/}\"" "$1/apps/events/backend/package.json" "$1/apps/events/frontend/package.json" 2>/dev/null; then
|
||||
printf '%s\n' "$p"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Only this app's workspaces (and the shared packages it uses), never the other products'.
|
||||
# --include=dev: the TypeScript and Next builds need type and build packages even where
|
||||
# NODE_ENV=production; --include-workspace-root for the packages' build tool (tsup).
|
||||
events_install_deps() {
|
||||
run_as "$2" "$1" npm ci --include=dev --no-audit --no-fund -w apps/events/backend -w apps/events/frontend
|
||||
local -a shared=() ws=()
|
||||
local p
|
||||
mapfile -t shared < <(events_shared_packages "$1")
|
||||
for p in "${shared[@]}"; do ws+=(-w "$p"); done
|
||||
if [ "${#shared[@]}" -gt 0 ]; then ws+=(--include-workspace-root); fi
|
||||
run_as "$2" "$1" npm ci --include=dev --no-audit --no-fund "${ws[@]}" -w apps/events/backend -w apps/events/frontend
|
||||
}
|
||||
|
||||
events_migrate() {
|
||||
@@ -47,6 +64,10 @@ events_pending_migrations() {
|
||||
}
|
||||
|
||||
events_build() {
|
||||
local p
|
||||
while IFS= read -r p; do
|
||||
run_as "$2" "$1/$p" npm run build || return 1
|
||||
done < <(events_shared_packages "$1")
|
||||
run_as "$2" "$(events_app "$1")/backend" npm run build &&
|
||||
run_as "$2" "$(events_app "$1")/frontend" npm run build
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bats
|
||||
# Cross Events' hooks that don't need a server: which shared packages a checkout builds first
|
||||
# (contracts and seo from 2.4.0), and that an older checkout (2.3.x) builds without them.
|
||||
# Run with `npm run test:scripts`.
|
||||
|
||||
setup() {
|
||||
# shellcheck source=../products/events.sh
|
||||
source "$BATS_TEST_DIRNAME/../products/events.sh"
|
||||
TMP="$BATS_TEST_TMPDIR"
|
||||
CALLS="$TMP/calls"
|
||||
: > "$CALLS"
|
||||
# Record what would run, as the app user, instead of running it.
|
||||
run_as() { local user="$1" dir="$2"; shift 2; echo "$user|${dir#"$TMP"/}|$*" >> "$CALLS"; }
|
||||
}
|
||||
|
||||
checkout() {
|
||||
local dir="$TMP/$1"; shift
|
||||
mkdir -p "$dir/apps/events/backend" "$dir/apps/events/frontend" "$dir/packages/contracts" "$dir/packages/seo"
|
||||
echo '{"name":"@crosscode/contracts"}' > "$dir/packages/contracts/package.json"
|
||||
echo '{"name":"@crosscode/seo"}' > "$dir/packages/seo/package.json"
|
||||
printf '{"dependencies":{%s}}' "$1" > "$dir/apps/events/backend/package.json"
|
||||
printf '{"dependencies":{%s}}' "$2" > "$dir/apps/events/frontend/package.json"
|
||||
}
|
||||
|
||||
@test "2.4.0: contracts and seo are installed and built before Events" {
|
||||
checkout new '"@crosscode/contracts":"*"' '"@crosscode/contracts":"*","@crosscode/seo":"*"'
|
||||
run events_shared_packages "$TMP/new"
|
||||
[ "$output" = $'packages/contracts\npackages/seo' ]
|
||||
|
||||
events_install_deps "$TMP/new" hope
|
||||
grep -qx 'hope|new|npm ci --include=dev --no-audit --no-fund -w packages/contracts -w packages/seo --include-workspace-root -w apps/events/backend -w apps/events/frontend' "$CALLS"
|
||||
|
||||
: > "$CALLS"
|
||||
events_build "$TMP/new" hope
|
||||
[ "$(cut -d'|' -f2 "$CALLS" | tr '\n' ' ')" = "new/packages/contracts new/packages/seo new/apps/events/backend new/apps/events/frontend " ]
|
||||
}
|
||||
|
||||
@test "2.3.x (no shared packages used): installed and built as before" {
|
||||
checkout old '' ''
|
||||
run events_shared_packages "$TMP/old"
|
||||
[ -z "$output" ]
|
||||
events_install_deps "$TMP/old" hope
|
||||
grep -qx 'hope|old|npm ci --include=dev --no-audit --no-fund -w apps/events/backend -w apps/events/frontend' "$CALLS"
|
||||
: > "$CALLS"
|
||||
events_build "$TMP/old" hope
|
||||
[ "$(cut -d'|' -f2 "$CALLS" | tr '\n' ' ')" = "old/apps/events/backend old/apps/events/frontend " ]
|
||||
}
|
||||
|
||||
@test "a failing package build stops before Events is built" {
|
||||
checkout new '"@crosscode/contracts":"*"' ''
|
||||
run_as() { echo "${2#"$TMP"/}" >> "$CALLS"; [[ "$2" != */packages/contracts ]]; }
|
||||
run events_build "$TMP/new" hope
|
||||
[ "$status" -ne 0 ]
|
||||
[ "$(cat "$CALLS")" = "new/packages/contracts" ]
|
||||
}
|
||||
Reference in New Issue
Block a user