Recently I deleted yarn.lock file manually on the monorepo and there are tons of dependencies compatibility issue.
And I found yarn upgrade and yarn outdated are useful commands.
Turned out yarn install or just yarn would only update yarn.lock whenever dependencies in package.json changed.
It won't update all packages to the latest stable version ( a.b.c, fixed a, and latest b and c ).
We can and should manually upgrade by yarn upgrade or npm 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.
Timing for me to use some yarn commands
yarn install or yarn -> on local dev
yarn install --frozen-lockfile --prefer-offline -> on ci
yarn outdated or yarn upgrade -> when we have time and wanna improve code quality by updating dependencies to latest stable version
https://classic.yarnpkg.com/lang/en/docs/cli/upgrade/
https://docs.npmjs.com/updating-packages-downloaded-from-the-registry