But what is a proper way for me to upgrade dependency in this semantic situation? Namely, to upgrade dependency to latest package and indicating that my app now depends on that version?
So this there?
This is what I'm trying to answer - I don't feel like this article reached a conclusion on this question... unless the answer is "no"?
yarn upgrade --latest does not respect version constraints - it installs the latest available versions, even if that conflicts with your constraints: "react": "^16.5.1" will change it to "react": "^18.2.0" which is not what I wanted.
I just want to upgrade to the next compatible version and update my package.json.
That's not a thing?
(I'm about a week into yarn and it's uber frustrating how many little ways it deviates from npm. I hate it. I wish it didn't exist. Why did we have to split the entire ecosystem in two like this? Because yarnused to be faster? ugh.)
yarn upgrade will respect your version constraints - as opposed to yarn upgrade --latest, which will most likely break everything.
syncyarnlock will transfer the installed version numbers from yarn.lock to package.json, plain and simple - the --save option makes it write the changes back to package.json, so you can git diff and review the results, while --keepPrefix will preserve the ^ or ~ operators in your existing package.json version constraints.
yarn install finally will update your yarn.lock using the updated version constraints - it won't install anything new at this point, but this step is required, or yarn will complain later that your yarn.lock is outdated with the new version constraints in your updated package.json.
So this there?
This is what I'm trying to answer - I don't feel like this article reached a conclusion on this question... unless the answer is "no"?
yarn upgrade --latestdoes not respect version constraints - it installs the latest available versions, even if that conflicts with your constraints:"react": "^16.5.1"will change it to "react": "^18.2.0" which is not what I wanted.I just want to upgrade to the next compatible version and update my
package.json.That's not a thing?
(I'm about a week into
yarnand it's uber frustrating how many little ways it deviates fromnpm. I hate it. I wish it didn't exist. Why did we have to split the entire ecosystem in two like this? Becauseyarnused to be faster? ugh.)Okay, so I finally found the answer I was looking for:
yarn upgradewill respect your version constraints - as opposed toyarn upgrade --latest, which will most likely break everything.syncyarnlock will transfer the installed version numbers from
yarn.locktopackage.json, plain and simple - the--saveoption makes it write the changes back topackage.json, so you cangit diffand review the results, while--keepPrefixwill preserve the^or~operators in your existingpackage.jsonversion constraints.yarn installfinally will update youryarn.lockusing the updated version constraints - it won't install anything new at this point, but this step is required, or yarn will complain later that youryarn.lockis outdated with the new version constraints in your updatedpackage.json.That was fantastic, thanks!!