Skip to content

Instantly share code, notes, and snippets.

View bushong1's full-sized avatar

Charles Bushong bushong1

View GitHub Profile
@bushong1
bushong1 / npmdeps.sh
Last active August 29, 2015 14:14
Determine full npm dependencies of a node.js package.
#Add to .bashrc
#Usage: npmdeps <package>[@<version>]
function npmdeps {
regex="^[- |]*$"
regex_space="^ *$"
regex_github="github\.com"
if [[ "$1" =~ $regex ]]; then
return
else
DEPS=`npm info $1 dependencies|perl -0777 -pe 's/^.*{//gs'|perl -0777 -pe 's/}.*$//gs'| sed "s/[\{\}' ]//g" | sed 's/, \?/\n/g' | sed "s/:/@/g"`