Skip to content

Instantly share code, notes, and snippets.

@normenster
Created September 9, 2025 07:31
Show Gist options
  • Select an option

  • Save normenster/da63009f4207378e5e26ace08fe7ee31 to your computer and use it in GitHub Desktop.

Select an option

Save normenster/da63009f4207378e5e26ace08fe7ee31 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# List of banned packages with versions
banned=(
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
"[email protected]"
)
echo "Scanning for installed versions..."
echo
for entry in "${banned[@]}"; do
pkg="${entry%@*}" # package name
bad_ver="${entry#*@}" # banned version
# Get all installed versions of this package
installed=$(yarn list --pattern "$pkg" --depth=9999 2>/dev/null \
| grep "$pkg@" \
| sed -E 's/.*'"$pkg"'@([0-9]+\.[0-9]+\.[0-9]+).*/\1/' \
| sort -u)
if [ -z "$installed" ]; then
echo "$pkg : not installed"
else
if echo "$installed" | grep -q "^$bad_ver$"; then
echo "❌ $pkg : banned $bad_ver is INSTALLED → found versions: $installed"
else
echo "✅ $pkg : banned $bad_ver not present → found versions: $installed"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment