diff --git a/CHANGELOG.md b/CHANGELOG.md index 7050edd..f982153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …). +## crosscode script - 2026-11-19 (no tag: servers run `main`) + +- **A church with Accounts couldn't be updated.** `crosscode install` / `add` writes Accounts' PM2 + config to `apps/accounts/ecosystem.config.cjs`, which no `.gitignore` covered, so the next + `deploy` stopped at "files … were changed or added by hand: ?? apps/accounts/ecosystem.config.cjs". + The PM2 configs crosscode makes (`apps/events/ecosystem.config.js`, `apps/accounts/ecosystem.config.cjs`) + no longer count as changes by hand, also in checkouts of releases that don't ignore them, and + `apps/accounts/.gitignore` ignores it from the next Accounts release on. bats test. + ## events@3.0.0, accounts@1.1.0, contracts@1.8.0, crosscode script - 2026-11-19 Cross Events signs in through the church's Accounts (ROADMAP-v3 phase 4, docs/EVENTS-3.0-PLAN.md). diff --git a/apps/accounts/.gitignore b/apps/accounts/.gitignore new file mode 100644 index 0000000..b9d75dc --- /dev/null +++ b/apps/accounts/.gitignore @@ -0,0 +1,2 @@ +# this install's PM2 config (made from ecosystem.config.example.cjs by the crosscode script) +/ecosystem.config.cjs diff --git a/scripts/lib/common.sh b/scripts/lib/common.sh index cb5b2c3..948e30e 100644 --- a/scripts/lib/common.sh +++ b/scripts/lib/common.sh @@ -353,5 +353,12 @@ wait_for_version() { node_major() { node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0; } # Files changed or added by hand in a checkout (ignored files such as .env, uploads, backups and -# the install's ecosystem.config.js never count). -local_changes() { git_in "$1" status --porcelain --untracked-files=all; } +# the install's ecosystem.config.js never count). The PM2 configs this script makes for each +# install never count either, also in checkouts of releases that don't ignore them yet (Accounts +# 1.0–1.1 has no .gitignore for its ecosystem.config.cjs). +CROSSCODE_OWN_FILES=(apps/events/ecosystem.config.js apps/accounts/ecosystem.config.cjs) +local_changes() { + git_in "$1" status --porcelain --untracked-files=all | awk -v own="${CROSSCODE_OWN_FILES[*]}" ' + BEGIN { n = split(own, f, " "); for (i = 1; i <= n; i++) skip[f[i]] = 1 } + !(substr($0, 1, 2) == "??" && substr($0, 4) in skip)' +} diff --git a/scripts/tests/deploy.bats b/scripts/tests/deploy.bats index aac116f..aae368c 100644 --- a/scripts/tests/deploy.bats +++ b/scripts/tests/deploy.bats @@ -146,6 +146,19 @@ cc() { bash "$CROSSCODE_HOME/crosscode" "$@"; } [ ! -s "$LOG" ] } +@test "the PM2 configs crosscode makes don't count as changes by hand" { + echo "module.exports = {}" > "$CROSSCODE_SITES/hope/events/apps/events/ecosystem.config.js" + mkdir -p "$CROSSCODE_SITES/hope/events/apps/accounts" + echo "module.exports = {}" > "$CROSSCODE_SITES/hope/events/apps/accounts/ecosystem.config.cjs" + run cc deploy hope events --version events@2.2.1 --check + [ "$status" -eq 0 ] + # Anything else added there still does. + echo "notes" > "$CROSSCODE_SITES/hope/events/apps/accounts/notes.txt" + run cc deploy hope events --version events@2.2.1 --check + [ "$status" -eq 1 ] + [[ "$output" == *"apps/accounts/notes.txt"* ]] +} + @test "--allow-local-changes deploys with a file added by hand" { echo "notes" > "$CROSSCODE_SITES/hope/events/apps/events/notes.txt" run cc deploy hope events --version events@2.2.1