crosscode: envtpl as .cjs (Node CommonJS for the root lint)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 13:26:00 +02:00
co-authored by Claude Opus 5.5
parent d61b3e5978
commit 92869d2683
4 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ env_apply() {
shift 3 shift 3
local -a conf=() local -a conf=()
[ -n "$CROSSCODE_CONFIG" ] && conf=(--config "$CROSSCODE_CONFIG") [ -n "$CROSSCODE_CONFIG" ] && conf=(--config "$CROSSCODE_CONFIG")
node "$CROSSCODE_HOME/lib/envtpl.js" --template "$(env_template "$app" "$product")" --dir "$app" \ node "$CROSSCODE_HOME/lib/envtpl.cjs" --template "$(env_template "$app" "$product")" --dir "$app" \
--product "$product" --release "$release" "${conf[@]+"${conf[@]}"}" "$@" --product "$product" --release "$release" "${conf[@]+"${conf[@]}"}" "$@"
} }
@@ -45,7 +45,7 @@ env_apply_template() {
shift 4 shift 4
local -a conf=() local -a conf=()
[ -n "$CROSSCODE_CONFIG" ] && conf=(--config "$CROSSCODE_CONFIG") [ -n "$CROSSCODE_CONFIG" ] && conf=(--config "$CROSSCODE_CONFIG")
node "$CROSSCODE_HOME/lib/envtpl.js" --template "$tpl" --dir "$app" \ node "$CROSSCODE_HOME/lib/envtpl.cjs" --template "$tpl" --dir "$app" \
--product "$product" --release "$release" "${conf[@]+"${conf[@]}"}" "$@" --product "$product" --release "$release" "${conf[@]+"${conf[@]}"}" "$@"
} }
@@ -4,7 +4,7 @@
// and `crosscode deploy` (files exist: only variables they don't have are appended, with a // and `crosscode deploy` (files exist: only variables they don't have are appended, with a
// comment; existing lines are never changed or removed). // comment; existing lines are never changed or removed).
// //
// node envtpl.js --template <file> --dir <product dir> [--config <job config JSON>] // node envtpl.cjs --template <file> --dir <product dir> [--config <job config JSON>]
// [--product events] [--var domain=… --var apiPort=…] [--fallback NAME=value] // [--product events] [--var domain=… --var apiPort=…] [--fallback NAME=value]
// [--release events@x.y.z] [--check] // [--release events@x.y.z] [--check]
// //
+1 -1
View File
@@ -110,7 +110,7 @@ events_keep() {
chmod -R go-rwx "$dest" chmod -R go-rwx "$dest"
} }
# --var arguments for the env template (envtpl.js), from church.env. # --var arguments for the env template (envtpl.cjs), from church.env.
events_env_vars() { events_env_vars() {
printf '%s\n' --var "domain=$(pvar events DOMAIN)" --var "apiPort=$(events_api_port)" --var "webPort=$(events_web_port)" --var "church=$(cenv CHURCH)" printf '%s\n' --var "domain=$(pvar events DOMAIN)" --var "apiPort=$(events_api_port)" --var "webPort=$(events_web_port)" --var "church=$(cenv CHURCH)"
} }
+2 -2
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env bats #!/usr/bin/env bats
# .env files from a product's env template (lib/envtpl.js, AGENT-1.0-PLAN §5): written whole on # .env files from a product's env template (lib/envtpl.cjs, AGENT-1.0-PLAN §5): written whole on
# install, only appended to on deploy, nothing written when a required value is missing. # install, only appended to on deploy, nothing written when a required value is missing.
setup() { setup() {
TMP="$BATS_TEST_TMPDIR" TMP="$BATS_TEST_TMPDIR"
TPL_JS="$BATS_TEST_DIRNAME/../lib/envtpl.js" TPL_JS="$BATS_TEST_DIRNAME/../lib/envtpl.cjs"
APP="$TMP/app" APP="$TMP/app"
mkdir -p "$APP/backend" "$APP/frontend" mkdir -p "$APP/backend" "$APP/frontend"
cat > "$TMP/template.json" <<'EOF' cat > "$TMP/template.json" <<'EOF'