Skip to content

Instantly share code, notes, and snippets.

@TravelingTechGuy
Created January 29, 2014 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TravelingTechGuy/8692935 to your computer and use it in GitHub Desktop.
Save TravelingTechGuy/8692935 to your computer and use it in GitHub Desktop.
Update (global) NPM repositories, and show which repositories were updated by comparing version numbers
npm -g ls --depth=0 > ~/before.txt
npm -g update > /dev/null 2>&1
npm -g ls --depth=0 > ~/after.txt
diff -as ~/before.txt ~/after.txt
rm ~/before.txt ~/after.txt
@TravelingTechGuy
Copy link
Author

Options to change this script:

  1. Remove the -g from lines 1-3, if you want to update a local project
  2. Change line 2 to just npm -g update, to get verbose update output
  3. Remove the -s parameter from line 4, to not receive the "files are identical" message
  4. Change the path temporary files are saved to, by replacing ~ with the desired path
  5. Remove line 5 to keep the "before" and "after" files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment