Skip to content

Instantly share code, notes, and snippets.

@ShaneQful
Last active September 10, 2016 14:36
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShaneQful/aa265f9ef87449b945b1 to your computer and use it in GitHub Desktop.
Save ShaneQful/aa265f9ef87449b945b1 to your computer and use it in GitHub Desktop.
A bash one liner to check if any of your dependent npm packages have a low number of stars on github
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
@remy
Copy link

remy commented Mar 27, 2016

To get this working on a mac, basically swap out grep -P for egrep

@mjlescano
Copy link

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