A bash one liner to check if any of your dependent npm packages have a low number of stars on github
This file contains 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
npm ls | grep -oP "\w[^@]+@" | sed s/@// | sort |uniq | awk '{print "npm view " $1 " repository.url"}' | sh | grep -oP "github(\w|\W)+\.git" | sed 's/.git//g' | sed 's/.com/.com\/repos/g' | awk '{print "curl -s \"https://api."$1"\" | grep -P \"(stargazers_count|full_name)\" "}' | sh |
To get this working on a mac, for lazy people:
npm ls | egrep -o "\w[^@]+@" | sed s/@// | sort |uniq | awk '{print "npm view " $1 " repository.url"}' | sh | egrep -o "github(\w|\W)+\.git" | sed 's/.git//g' | sed 's/.com/.com\/repos/g' | awk '{print "curl -s \"https://api."$1"\" | egrep \"(stargazers_count|full_name)\" "}' | sh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To get this working on a mac, basically swap out
grep -P
foregrep