`npm update --latest`

(Borek Bernard) #1

I didn’t find a topic for this yet; it would often be useful to have a command to bump all dependencies to their latest version, similarly to what yarn upgrade --latest does. Has this been discussed before and possibly rejected? Sounds like a natural feature for npm to me.

(Metaa) #2

I believe that npm update actually updates them according the semver constraints set in package.json, but I think just updating all of them to the latest version would rather break your code most of the time as it would easily update beyond breaking changes.

(Mark) #3

Yeah i definitely agree with you as a default. But I think that’s the reason to pass the --latest flag. Doing so means that the developer specifically is okay with all packages being updated and understands the risk of upgrading to versions that potentially will break things. Its definitely a rare case but there are times when this is especially wanted.

(Borek Bernard) #4

As Mark said.

I’d just say that bumping all dependencies to their latest versions (semver major, i.e., breaking changes) is very common for us, not rare. We do it regularly to stay up to date.