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
This commit is contained in:
gsb 2026-04-29 00:32:15 +00:00
parent 256c8d7090
commit 3869a3abdd

View File

@ -4,6 +4,18 @@ set -e
RIBBIT_DIR="lib/ribbit" RIBBIT_DIR="lib/ribbit"
STATIC_DIR="src/ttfrog/themes/default/static" 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..." echo "Building ribbit..."
cd "$RIBBIT_DIR" cd "$RIBBIT_DIR"
npm install --silent npm install --silent
@ -11,8 +23,6 @@ npm run build --silent
cd - > /dev/null cd - > /dev/null
echo "Copying ribbit dist files..." echo "Copying ribbit dist files..."
cp "$RIBBIT_DIR/dist/ribbit.js" "$STATIC_DIR/" cp -r "$RIBBIT_DIR/dist/." "$STATIC_DIR/"
cp "$RIBBIT_DIR/dist/ribbit.min.js" "$STATIC_DIR/"
cp "$RIBBIT_DIR/src/ribbit.css" "$STATIC_DIR/"
echo "ribbit build complete." echo "ribbit build complete."