#!/usr/bin/env bash # Vendor base.css / base.js from a LotusGuild web_template checkout into public/web_template/. # # Usage: scripts/sync-web-template.sh # # Writes public/web_template/{base.css,base.js} as regular files (never symlinks) and # public/web_template/VERSION containing "v1.2 ". set -euo pipefail SRC="${1:-}" if [ -z "$SRC" ]; then echo "usage: $0 " >&2 exit 2 fi if [ ! -d "$SRC" ]; then echo "error: source directory not found: $SRC" >&2 exit 2 fi REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" DEST="$REPO_ROOT/public/web_template" mkdir -p "$DEST" for f in base.css base.js; do if [ ! -f "$SRC/$f" ]; then echo "error: missing $SRC/$f" >&2 exit 1 fi rm -f "$DEST/$f" cp "$SRC/$f" "$DEST/$f" chmod 644 "$DEST/$f" echo "synced $f" done SHA="$(git -C "$SRC" rev-parse --short HEAD 2>/dev/null || echo unknown)" DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" printf 'v1.2 %s %s\n' "$SHA" "$DATE" > "$DEST/VERSION" echo "VERSION: $(cat "$DEST/VERSION")"