Skip to main content

Command Palette

Search for a command to run...

npm outdated

Updated
1 min read
npm outdated
S

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

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