Created
September 9, 2025 07:31
-
-
Save normenster/da63009f4207378e5e26ace08fe7ee31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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