Create a gist now

Instantly share code, notes, and snippets.

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
remy commented Mar 27, 2016

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

@mjlescano

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