vigia/bin/build-web.bash
Rénich Bon Ćirić 5aec03f3f5
feat(branding): integrate adaptive logo, update gateway domain to ipfs.mx-os.mx, and purge slashes
- Embed official vector logo in header and footer with theme-reactive CSS variables
- Update gateway identity to ipfs.mx-os.mx and update custodian to EVALinux in Jalisco
- Add direct navigation pill linking to community guardian registration guide
- Remove all spaces around forward slashes and standardize table column headers
- Ensure build script automatically synchronizes guardianes.json into web distribution

Co-authored-by: Antigravity <antigravity@google.com>
Signed-off-by: Rénich Bon Ćirić <renich@evalinux.com>
2026-10-09 02:49:54 -06:00

68 lines
2 KiB
Shell
Executable file

#!/usr/bin/bash
set -euo pipefail
IFS=$'\n\t'
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
WEB_SRC="${REPO_ROOT}/web/src"
WEB_DIST="${REPO_ROOT}/web/dist"
main() {
echo "==> [1/3] Limpiando artefactos previos en ${WEB_DIST}..."
mkdir -p "${WEB_DIST}"
rm -f "${WEB_DIST}"/*
echo "==> [2/3] Compilando y minificando con Bun..."
bun build --minify --target=browser --outdir="${WEB_DIST}" "${WEB_SRC}/app.ts"
if [[ ! -f "${WEB_DIST}/app.js" ]] || [[ ! -f "${WEB_DIST}/app.css" ]]; then
echo "Error: Bun no generó app.js o app.css en ${WEB_DIST}" >&2
exit 1
fi
local js_size
local css_size
js_size="$(du -h "${WEB_DIST}/app.js" | cut -f1)"
css_size="$(du -h "${WEB_DIST}/app.css" | cut -f1)"
echo " app.js: ${js_size}"
echo " app.css: ${css_size}"
echo "==> [3/3] Ensamblando archivo único autocontenido (vigia.html)..."
local output_html="${WEB_DIST}/vigia.html"
cat > "${output_html}" << 'HTML_HEAD'
<!DOCTYPE html>
<html lang="es" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Vigía | Observabilidad de Espejos IPFS</title>
<meta name="description" content="Telemetría en tiempo real y cartografía del enjambre P2P de espejos sobre IPFS de Fundación MxOS.">
<style>
HTML_HEAD
{
cat "${WEB_DIST}/app.css"
echo " </style>"
echo "</head>"
echo "<body>"
echo ' <div id="vigia-root"></div>'
echo " <script>"
cat "${WEB_DIST}/app.js"
echo " </script>"
echo "</body>"
echo "</html>"
} >> "${output_html}"
local total_size
total_size="$(du -h "${output_html}" | cut -f1)"
echo " Generado exitosamente: ${output_html} (${total_size})"
echo "==> Copiando guardianes.json a ${WEB_DIST}..."
cp "${REPO_ROOT}/guardianes.json" "${WEB_DIST}/guardianes.json"
echo "==> Proceso de compilación web completado."
}
main "$@"