Posted on: Written by: K-Sato
⚠️ This article was posted over 2 years ago. The information might be outdated. ⚠️

Table of Contents

Overview

Here are the definitions of both yarn upgrade and yarn upgarde --latest.

yarn upgrade

This command updates dependencies to their latest version based on the version range specified in the package.json file. The yarn.lock file will be recreated as well.

yarn upgrade —latest

The upgrade --latest command upgrades packages the same as the upgrade command, but ignores the version range specified in package.json. Instead, the version specified by the latest tag will be used (potentially upgrading the packages across major versions). The package.json file will be updated to reflect the latest version range.

Conclusion

Adding the --latest flag will ignore the semantic version range in package.json, so the version upgraded to may not fit that range, so the package.json file is updated to reflect the new latest version.

Resources

About the author

I am a web-developer based somewhere on earth. I primarily code in TypeScript, Go and Ruby at work. React, RoR and Gin are my go-to Frameworks.