#!/usr/bin/bash set -euo pipefail IFS=$'\n\t' readonly ScriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly RepoRoot="$(cd "${ScriptDir}/.." && pwd)" readonly WebSrc="${RepoRoot}/web/src" readonly WebVendor="${RepoRoot}/web/vendor" readonly WebDist="${RepoRoot}/web/dist" main() { echo "==> [1/3] Preparando directorio de distribución en ${WebDist}..." mkdir -p "${WebDist}" rm -f "${WebDist}/vigia.html" "${WebDist}/app.js" "${WebDist}/app.css" echo "==> [2/3] Ensamblando archivo único autocontenido (vigia.html)..." local output_html="${WebDist}/vigia.html" if [[ ! -f "${WebVendor}/leaflet/leaflet.css" ]] || [[ ! -f "${WebVendor}/leaflet/leaflet.js" ]]; then echo "Error: Dependencias de Leaflet no encontradas en ${WebVendor}/leaflet" >&2 exit 1 fi if [[ ! -f "${WebSrc}/app.js" ]] || [[ ! -f "${WebSrc}/style.css" ]]; then echo "Error: Fuentes web (app.js o style.css) no encontrados en ${WebSrc}" >&2 exit 1 fi cat > "${output_html}" << 'HTML_HEADER'