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:
+13
-3
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user