refactor(pack): template CustomSkinLoader + unify pack rendering

Add tooling/render-pack.sh: renders all pack/**/*.tmpl with ${BASE_DOMAIN}
(no dnsmasq HOST_LAN_IP coupling) and rebuilds the packwiz index. Both
render-config.sh and add-custom-mod.sh now delegate to it.

CustomSkinLoader.json's skin API roots are no longer frozen — it becomes
CustomSkinLoader.json.tmpl, rendered like the mod metadata. .packwizignore
broadened to *.tmpl; rendered .json gitignored as build output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 22:42:32 +02:00
parent 853405afe7
commit 6e91749f59
7 changed files with 47 additions and 34 deletions

View File

@@ -124,17 +124,9 @@ log "adding ${#JARS[@]} jar(s), side=${SIDE}"
for j in "${JARS[@]}"; do add_one "$j"; done
# ---- render + refresh once -------------------------------------------------
# Render every metadata template -> .pw.toml (inject ${BASE_DOMAIN} only — no
# coupling to dnsmasq's HOST_LAN_IP), then rebuild the packwiz index. This is
# the same render render-config.sh does at deploy; kept inline so adding a mod
# works with just BASE_DOMAIN set.
# render-pack.sh renders all pack templates (BASE_DOMAIN only) + rebuilds the
# packwiz index. Single source of pack-render logic, shared with render-config.
log "rendering metadata + refreshing index"
for t in pack/mods/*.pw.toml.tmpl; do
envsubst '${BASE_DOMAIN}' < "$t" > "${t%.tmpl}"
done
# index.toml is gitignored build output; seed a minimal one so packwiz refresh
# (which won't bootstrap a missing index) has something to populate.
[ -f pack/index.toml ] || printf 'hash-format = "sha256"\n' > pack/index.toml
( cd pack && packwiz refresh )
tooling/render-pack.sh
log "done — ${#JARS[@]} mod(s) added to the pack"
echo " commit: custom/*.jar + pack/mods/*.pw.toml.tmpl (rendered .pw.toml/index are gitignored)"