fix(pousse): support multisite front builds

Read deploy.default_site_code from project conf and inject NEXT_PUBLIC_SITE_CODE when building front-common.

Also align lecoffreio build_dirs and version paths with back-common/front-common/ressources-common.
This commit is contained in:
Nicolas Cantu 2026-04-10 14:35:19 +02:00
parent 8a73fea3c8
commit 45992c6145
2 changed files with 18 additions and 5 deletions

View File

@ -125,10 +125,12 @@ if [[ "$author_name" != "4NK" && "$author_name" != "Nicolas Cantu" ]]; then
fi
# Build dirs from project config (projects/<id>/conf.json); skip if no config or no build_dirs
build_dirs=()
default_site_code=""
if [[ -n "${PROJECT_CONFIG_PATH:-}" && -f "$PROJECT_CONFIG_PATH" ]] && command -v jq >/dev/null 2>&1; then
while IFS= read -r d; do
[[ -n "$d" ]] && build_dirs+=( "$d" )
done < <(jq -r '.build_dirs[]? // empty' "$PROJECT_CONFIG_PATH" 2>/dev/null)
default_site_code="$(jq -r '.deploy.default_site_code // empty' "$PROJECT_CONFIG_PATH" 2>/dev/null)"
fi
if [[ ${#build_dirs[@]} -gt 0 ]]; then
# shellcheck source=../lib/conf_path_resolve.sh
@ -146,6 +148,16 @@ if [[ ${#build_dirs[@]} -gt 0 ]]; then
echo "[pousse][WARN] Skipping build ${dir} (directory not found)" >&2
continue
fi
build_basename="$(basename "$abs_dir")"
if [[ -n "$default_site_code" && -z "${NEXT_PUBLIC_SITE_CODE:-}" && ( "$build_basename" == "front-common" || "$build_basename" == "lecoffre-front-main" ) ]]; then
echo "[pousse] Building ${dir} (NEXT_PUBLIC_SITE_CODE=${default_site_code})..."
(cd "$abs_dir" && env "NEXT_PUBLIC_SITE_CODE=${default_site_code}" npm run build) || {
echo "[pousse][ERROR] Build failed in ${dir}" >&2
exit 1
}
continue
fi
echo "[pousse] Building ${dir}..."
(cd "$abs_dir" && npm run build) || {
echo "[pousse][ERROR] Build failed in ${dir}" >&2

View File

@ -3,9 +3,9 @@
"name": "Lecoffre.io",
"project_path": "/home/desk/code/lecoffre_ng_test/deploy",
"build_dirs": [
"/home/desk/code/lecoffre_ng_test/lecoffre-ressources-dev",
"/home/desk/code/lecoffre_ng_test/lecoffre-back-main",
"/home/desk/code/lecoffre_ng_test/lecoffre-front-main"
"/home/desk/code/lecoffre_ng_test/ressources-common",
"/home/desk/code/lecoffre_ng_test/back-common",
"/home/desk/code/lecoffre_ng_test/front-common"
],
"deploy": {
"repository_root": "/home/desk/code/lecoffre_ng_test",
@ -13,12 +13,13 @@
"deploy_script_path": "/home/desk/code/lecoffre_ng_test/deploy/scripts_v2/deploy.sh",
"project_orchestrator_path": "deploy/scripts_v2/deploy.sh",
"secrets_path": "/home/desk/code/ia_dev/projects/lecoffreio/.secrets",
"default_site_code": "notary",
"host_stays_on_test": true
},
"version": {
"package_json_paths": [
"/home/desk/code/lecoffre_ng_test/lecoffre-back-main/package.json",
"/home/desk/code/lecoffre_ng_test/lecoffre-front-main/package.json"
"/home/desk/code/lecoffre_ng_test/back-common/package.json",
"/home/desk/code/lecoffre_ng_test/front-common/package.json"
],
"splash_app_name": "LeCoffre.io"
},