Form Rig

Find outdated NPMs in many projects

Eric Fortis

This script inspects projects concurrently and outputs pasteable lines for upgrading NPM dependencies.

Output example

cd $REPO/AppSPA     && npm i react@17.0.2      ;# react@17.0.0
cd $REPO/AccountSPA && npm i webpack@5.2.0     ;# webpack@5.1.0

Where react@17.0.2 is the latest version and react@17.0.0 is currently installed.

Script

#!/bin/sh

apps="
AppSPA
AccountSPA
ServerSide
"

npmo() {
  local pids=""
  for app in $apps; do
    cd $REPO/$app
    npm outdated --parseable |\
      awk -v app="$app" -F: \
      '{ printf "cd $REPO/%-10s && npm i %-20s ;# %s\n", app, $4, $2 }' &
    pids="$pids $!"
  done
  wait $pids
}

npmo | sort -k6

Opening the repo's homepage

To see the changelogs, for example on a Github repository, replace the last line with:

npmo | sort -k6 |\
  tee /dev/tty |\
  awk '{print $6}' | uniq | xargs npm repo 

Sponsored by: