#!/usr/bin/env sh set -eu root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) site="$root/build/site" rm -rf "$site" mkdir -p "$site" build_package() { package_path=$1 package_name=$2 destination=$3 echo ":: building ${package_name} documentation" (cd "$root/$package_path" && gleam docs build) mkdir -p "$site/$destination" cp -R \ "$root/$package_path/build/dev/docs/$package_name/." \ "$site/$destination/" # README links target repository Markdown. Point documentation-page links at # the generated HTML files while preserving README navigation in the source. index="$site/$destination/index.html" rewritten_index="${index}.tmp" sed -E 's|href="docs/([^"]+)\.md"|href="\1.html"|g' \ "$index" > "$rewritten_index" mv "$rewritten_index" "$index" } build_package . factos factos build_package backends/factos_pog factos_pog factos_pog build_package backends/factos_sqlight factos_sqlight factos_sqlight build_package backends/factos_cf factos_cf factos_cf cat > "$site/index.html" <<'HTML' Factos documentation

Factos documentation

Context-first event sourcing for Gleam.

HTML printf 'Documentation site built at %s\n' "$site"