npm outdated --parseable --depth=0 | cut -d: -f4 | xargs npm install
Per the official documentation, here's what yarn upgrade --latest
does:
The
upgrade --latest
command upgrades packages the same as theupgrade
command, but ignores the version range specified inpackage.json
. Instead, the version specified by thelatest
tag will be used (potentially upgrading the packages across major versions).
As best I can tell, there is no equivalent command for npm
, though people have asked for it and have even created npm
packages that do this.
Based on another gist, this is a one-liner that achieves similar behavior.
Warning: this will overwrite your currently installed packages, and — as always when chaining multiple commands — things can go wrong. Please understand what you're doing, and don't run this command if you're worried about your environment or package.json
getting messed up.