Skip to main content

npm outdated

Published 1 min readMarkdown
npm outdated

Find outdated npm packages

Simply run the below script and it will show you the packages you want to update

The results will have the below columns:

  1. Sl No.

  2. Package

  3. Type

  4. Current

  5. Wanted

  6. Latest

Here is the working script.

npm outdated --json 2>/dev/null \
| jq -r '
    to_entries[]
    | [.key,
       (.value.type // "-"),
       (.value.current // "-"),
       (.value.wanted // "-"),
       (.value.latest // "-")]
    | @tsv
' \
| sort -t$'\t' -k4V \
| awk 'BEGIN {print "S.No\tPackage\tType\tCurrent\tWanted\tLatest"} {print NR "\t" $0}' \
| column -s $'\t' -t

Output looks like this

10 views

About the author

  • Entrepreneur, Founder, Mentor. Also runs a Registered NGO. Visit my website: sandeepgokhale.com

No comments yet. Be the first to comment.