Skip to content

Instantly share code, notes, and snippets.

@jossemarGT
Last active August 15, 2016 20:33
Show Gist options
  • Select an option

  • Save jossemarGT/09a5844c8165b3106922a8c3fc71eb7d to your computer and use it in GitHub Desktop.

Select an option

Save jossemarGT/09a5844c8165b3106922a8c3fc71eb7d to your computer and use it in GitHub Desktop.
Tired of those "outdated" warns on your node.js project, now you have a lazy way to updated your modules. (Use with caution)
#!/bin/bash
# Force update for your local node modules, use with caution though
OUTDATED=`npm outdated`
while IFS=$'\n' read -ra item; do
if [[ $item == *"Package"* ]]; then
continue
fi
read -ra i <<< "$item"
for i in "${item[@]}"; do
version="${i[3]}"
pkg=`echo -n "${i[0]}" | cut -d ' ' -f 1`
npm install ${pkg}@${version} --force --save
done
done <<< "$OUTDATED"
npm prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment