microsoft / vscode-azurefunctions

Azure Functions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
MIT License
290 stars 131 forks source link

Use ~ for version instead of ^ #4082

Closed nturinski closed 2 months ago

nturinski commented 3 months ago

Basically, ~ is used to only accept new patch updates whereas ^ is supposed to accept new minor and patch updates. There must be a bug in semver because ^0.0.1 is not accepting v0.0.2 where as ~0.0.1 does even though both should work.

We're going to have to simship these changes (+/- a couple of days). Since we are shipping both anyway, we may want to revisit if we just want to call the ACA API version 1.0.0 and go from there since that would actually be more helpful for tracking the versioning of our API anyway.

Ref: https://stackoverflow.com/questions/22343224/whats-the-difference-between-tilde-and-caret-in-package-json

bwateratmsft commented 3 months ago

The caret syntax ^ ignores leading zeros, with the leftmost nonzero number as the major. So 0.0.2 is considered a major change from 0.0.1. Similarly, 0.2.0 is a major change from 0.1.0.

AFAIK the tilde syntax ~ takes as specific as you ask for. So if you ask for ~0.0.1, then 0.0.2 should not be accepted, but 0.0.1.1 should. If you ask for ~1, then 1.2 and 1.3 are accepted but 2.0 is not.

Editing to add: Crucially, NPM does not exactly follow semver.

nturinski commented 3 months ago

Interestingly, with my testing, "~0.0.1" did seem to work with "0.0.2". But in light of everything you just explained, I would opt for us to just bump the API version to 1.0.0.

nturinski commented 3 months ago

Relies on this https://github.com/microsoft/vscode-azurecontainerapps/pull/674

We should try to release at around the same time. I think a day or two delay between the two won't be a huge deal though.

nturinski commented 3 months ago

We'll deal with this later when we're not trying to do a million things at once.