crosscode: Accounts' own PM2 config no longer stops deploys

install/add writes apps/accounts/ecosystem.config.cjs, which no .gitignore
covered, so the next deploy refused: "?? apps/accounts/ecosystem.config.cjs
... changed or added by hand". local_changes skips the PM2 configs the
script makes (also in existing checkouts); apps/accounts/.gitignore for
future releases. bats test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 20:09:44 +02:00
co-authored by Claude Opus 5.5
parent 9bcd24bbbd
commit 4b033a1d1d
4 changed files with 33 additions and 2 deletions
+9 -2
View File
@@ -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)'
}
+13
View File
@@ -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