0
0
#!/bin/sh
# Renders site/index.md (with README.md sections spliced in) and the user docs to site/out, the tree of
# https://socialweb.computer/. marked, mermaid and puppeteer-core: site/deno.json, locked by site/deno.lock; deno:
# site/deno.sh; the mermaid diagrams become inline SVG in the pinned Chrome of tests/compositions/staging/page-tools.json
# (PATH's google-chrome, or $CHROME, when it is that version, else the one tools.sh fetches and checks by its sha256).
# site/build.sh
set -eu
cd "$(dirname "$0")/.."
pin=$(jq -er .chrome.version tests/compositions/staging/page-tools.json)
chrome=${CHROME:-google-chrome}
if ! "$chrome" --version 2>/dev/null | grep -qw "$pin"; then
tools=$(SWC_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/socialweb-site" SWC_REPO="$PWD" bash tests/compositions/staging/tools.sh chrome)
chrome=$tools/chrome/chrome
fi
chrome=$(command -v "$chrome")
export TMPDIR="${TMPDIR:-$HOME/.tmp}"
mkdir -p "$TMPDIR"
site/deno.sh install --config site/deno.json --frozen >/dev/null
SITE_CHROME=$chrome exec site/deno.sh run --config site/deno.json --frozen \
--allow-read --allow-write="site/out,$TMPDIR" --allow-run --allow-env --allow-sys --allow-net=127.0.0.1,localhost \
site/build.ts