From 3869a3abdd52d94ad598cac220962272be94b3b5 Mon Sep 17 00:00:00 2001 From: gsb Date: Wed, 29 Apr 2026 00:32:15 +0000 Subject: [PATCH] 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 --- .slam/hooks/pre_build | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.slam/hooks/pre_build b/.slam/hooks/pre_build index d006e5f..72b6b9d 100755 --- a/.slam/hooks/pre_build +++ b/.slam/hooks/pre_build @@ -4,6 +4,18 @@ 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 @@ -11,8 +23,6 @@ npm run build --silent cd - > /dev/null echo "Copying ribbit dist files..." -cp "$RIBBIT_DIR/dist/ribbit.js" "$STATIC_DIR/" -cp "$RIBBIT_DIR/dist/ribbit.min.js" "$STATIC_DIR/" -cp "$RIBBIT_DIR/src/ribbit.css" "$STATIC_DIR/" +cp -r "$RIBBIT_DIR/dist/." "$STATIC_DIR/" echo "ribbit build complete."