Skip to content

Instantly share code, notes, and snippets.

@simong
Created October 17, 2014 10:24
Show Gist options
  • Select an option

  • Save simong/4aa95363e21ce486c1f3 to your computer and use it in GitHub Desktop.

Select an option

Save simong/4aa95363e21ce486c1f3 to your computer and use it in GitHub Desktop.
Sort your npm dependencies on when they were last published
#!/bin/sh
# Get all the non-git, non-oae modules
modules=$(npm ls --depth=0 | grep -v git | grep -v oae- | cut -f 2 -d ' ')
for module in $modules ; do
name=$(echo $module | cut -f 1 -d '@')
version=$(echo $module | cut -f 2 -d '@')
# Get the timestamp
echo $published=$(npm show $module | grep "'$version': '" | cut -f 4 -d "'") $module >> /tmp/published.txt
# Give an indication of where we're at
echo $published $module
done
# Sort them
cat /tmp/published.txt | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment