Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save normenster/6f46f35c3c45e35e3250aa98a6d919bc to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# List of banned packages with versions
banned=(
"ansi-styles@6.2.2"
"debug@4.4.2"
"chalk@5.6.1"
"supports-color@10.2.1"
"strip-ansi@7.1.1"
"ansi-regex@6.2.1"
"wrap-ansi@9.0.1"
"color-convert@3.1.1"
"color-name@2.0.1"
"is-arrayish@0.3.3"
"slice-ansi@7.1.1"
"color@5.0.1"
"color-string@2.1.1"
"simple-swizzle@0.2.3"
"supports-hyperlinks@4.1.1"
"has-ansi@6.0.1"
"chalk-template@1.1.1"
"backslash@0.2.1"
)
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