Skip to content

Instantly share code, notes, and snippets.

@ElMesa
Created December 2, 2014 16:05
Show Gist options
  • Save ElMesa/75cabd38868274b8ca21 to your computer and use it in GitHub Desktop.
Save ElMesa/75cabd38868274b8ca21 to your computer and use it in GitHub Desktop.
Shell - List first depth level web dependencies (npm, Bower)
# Im using this at ~/.bashrc
#
# You could also put it in a external file "~/.bash_webdev-dependencies" and import it to ".bashrc" with:
#. ~/.bash_webdev-dependencies
#
# I guess you could also make .sh and soft linkit to somewhere in the $PATH, but this seems simpler and cleaner
################
##### npm #####
alias npmlistshort='npm list --depth=0'
##################
##### Bower #####
alias bowerlistshort='bower list | grep '"'"'^├\|^└'"'"''
# The grep stuff at "bowerlistshort" its to extract the first level dependencies
# The '"'"' at grep it's to include the character ' in the alias (From: http://stackoverflow.com/questions/1250079/escaping-single-quotes-within-single-quoted-strings)
# The combo
function webdev-dependencies() {
echo Bower
bowerlistshort
echo
echo npm
npmlistshort
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment