The update system in yarn / NPM is a bit confusing to me. You run update and packages gets updated but nothing happens in package.json. I know yarn-lock handles it but again, i don't understand it 100% and it feels a bit unclear.
What i want is a way of actually update the version numbers in package.json and today i found a way. The trick is to use.
yarn upgrade-interactive --latest
This will give you a prompt where you can pick what packages you want to update and it will actually also update the version number in package.json. The trick is the --latest flag.
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. By default, the existing range specifier in package.json will be reused if it is one of: ^, ~, <=, >, or an exact version. Otherwise, it will be changed to a caret (^). One of the flags --caret, --tilde or --exact can be used to explicitly specify a range.
Top comments (0)