How to automatically update pubcpec.yaml minor and patch versions?

145 views Asked by At

When running

flutter pub upgrade --major-versions

I noticed upgrades for versions like 1.2.3 -> 1.2.4 are ignored and pubscpec.yaml is not updated!

It looks like this command doesn't update minor or patch level upgrades. Any automated tools that could do this and update pubspec.yaml as well?

1

There are 1 answers

0
Randal Schwartz On BEST ANSWER

If you have a working solution, and you want to edit those as the base-caret versions, I have this command line you can run on pubspec.lock file and it generates the dependencies part of the pubspec.yaml:

yq -Y '[.packages[] | select(.dependency == "direct main") | {(.description.name):"^\(.version)"}] | add | {dependencies: .}' pubspec.lock

It requires the installation of the "yq" package, which is really handy for manipulating YAML in a jq-like fashion.