Monorepo for Tangled
tangled.org
1#!/usr/bin/env bash
2set -euo pipefail
3
4HTMX_URL="https://unpkg.com/htmx.org@2.0.4/dist/htmx.min.js"
5HTMX_WS_URL="https://cdn.jsdelivr.net/npm/htmx-ext-ws@2.0.2"
6MERMAID_URL="https://cdn.jsdelivr.net/npm/mermaid@11.12.3/dist/mermaid.min.js"
7LUCIDE_URL="https://github.com/lucide-icons/lucide/releases/download/0.536.0/lucide-icons-0.536.0.zip"
8INTER_URL="https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip"
9PLEX_MONO_URL="https://github.com/IBM/plex/releases/download/%40ibm%2Fplex-mono%401.1.0/ibm-plex-mono.zip"
10ACTOR_TYPEAHEAD_REPO="https://tangled.org/@jakelazaroff.com/actor-typeahead"
11
12REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
13OUT="$REPO_ROOT/appview/pages/static"
14TMP="$(mktemp -d)"
15# trap 'rm -rf "$TMP"' EXIT
16
17mkdir -p "$OUT"/{fonts,icons,logos}
18
19curl -fsSL -o "$OUT/htmx.min.js" "$HTMX_URL"
20curl -fsSL -o "$OUT/htmx-ext-ws.min.js" "$HTMX_WS_URL"
21curl -fsSL -o "$OUT/mermaid.min.js" "$MERMAID_URL"
22
23curl -fsSL -o "$TMP/lucide.zip" "$LUCIDE_URL"
24unzip -q "$TMP/lucide.zip" -d "$TMP/lucide"
25cp -rf "$TMP"/lucide/icons/*.svg "$OUT/icons/"
26
27curl -fsSL -o "$TMP/inter.zip" "$INTER_URL"
28unzip -q "$TMP/inter.zip" -d "$TMP/inter"
29cp -f "$TMP"/inter/web/InterVariable*.woff2 "$OUT/fonts/"
30cp -f "$TMP"/inter/web/InterDisplay*.woff2 "$OUT/fonts/"
31cp -f "$TMP"/inter/InterVariable*.ttf "$OUT/fonts/"
32
33curl -fsSL -o "$TMP/plex.zip" "$PLEX_MONO_URL"
34unzip -q "$TMP/plex.zip" -d "$TMP/plex"
35cp -f "$TMP"/plex/ibm-plex-mono/fonts/complete/woff2/IBMPlexMono*.woff2 "$OUT/fonts/"
36
37git clone --depth=1 "$ACTOR_TYPEAHEAD_REPO" "$TMP/actor-typeahead"
38cp -f "$TMP/actor-typeahead/actor-typeahead.js" "$OUT/"
39
40(cd "$REPO_ROOT" && go build -o "$TMP/dolly" ./cmd/dolly)
41TEMPLATE="$REPO_ROOT/appview/pages/templates/fragments/dolly"
42"$TMP/dolly" -template "$TEMPLATE" -output "$OUT/logos/dolly.png" -size 180
43"$TMP/dolly" -template "$TEMPLATE" -output "$OUT/logos/dolly.ico" -size 48
44"$TMP/dolly" -template "$TEMPLATE" -output "$OUT/logos/dolly.svg" -color currentColor -favicon