#!/bin/bash # Tool: weblibreportal "publish" — build the Eleventy website and publish it into # the served data dir. The build runs as the manager (owns the install tree where # the source + node build live); the result is synced into the container-user-owned # docroot. Build-box only — needs the repo checkout + npm. appWeblibreportalPublish() { isHeader "Publish website (weblibreportal)" local app=weblibreportal local appdir="${install_containers_dir}${app}" local data="${containers_dir}${app}/data" command -v npm >/dev/null 2>&1 || { isError "npm not found — publishing the website needs a dev/build box."; return 1; } [[ -f "$appdir/package.json" ]] || { isError "website source not at $appdir — full repo checkout needed."; return 1; } isNotice "Building the site (Eleventy)..." if ! ( cd "$appdir" && runInstallOp npm install --silent && runInstallOp npm run build ); then isError "Site build failed." return 1 fi isNotice "Publishing into the docroot..." runFileOp mkdir -p "$data" runFileOp sh -c "rm -rf \"$data\"/* \"$data\"/.??* 2>/dev/null; cp -a \"$appdir/dist/.\" \"$data/\"" isSuccessful "Website published. Restart $app to serve it." }