diff --git a/npm-install-all.sh b/npm-install-all.sh index fc293fee..b85d7f24 100755 --- a/npm-install-all.sh +++ b/npm-install-all.sh @@ -1 +1,12 @@ -find . -name package.json -not -path "*/node_modules/*" -exec bash -c "npm --prefix \$(dirname {}) install --omit=dev --no-audit" \; +#!/bin/bash + +# Find all directories containing package.json files, up to 2 levels deep, excluding node_modules +directories=$(find . -maxdepth 3 -type d -name "node_modules" -prune -o -type f -name "package.json" -exec dirname {} \;) + +# Loop through each directory +for dir in $directories; do + echo "Installing dependencies in $dir" + cd "$dir" || exit 1 + npm install + cd - || exit 1 +done