vtt/.slam/hooks/pre_build
gsb 3869a3abdd Check for node/npm before building ribbit
pre_build hook now warns and skips the ribbit build if node or npm
are not installed, instead of failing the entire slam build.

Also, copy all of dist/ instead of individual files
2026-04-29 00:32:15 +00:00

29 lines
644 B
Bash
Executable File

#!/bin/sh
set -e
RIBBIT_DIR="lib/ribbit"
STATIC_DIR="src/ttfrog/themes/default/static"
missing=""
command -v node >/dev/null 2>&1 || missing="$missing node"
command -v npm >/dev/null 2>&1 || missing="$missing npm"
if [ -n "$missing" ]; then
echo ""
echo "WARNING: ribbit build skipped — missing dependencies:$missing"
echo "Install Node.js to enable ribbit builds: https://nodejs.org"
echo ""
exit 0
fi
echo "Building ribbit..."
cd "$RIBBIT_DIR"
npm install --silent
npm run build --silent
cd - > /dev/null
echo "Copying ribbit dist files..."
cp -r "$RIBBIT_DIR/dist/." "$STATIC_DIR/"
echo "ribbit build complete."