5 ms·
This is just called semver or semantic versioning. https://semver.org https://semver.org
by hadlock 5y ago
This is just called semver or semantic versioning. https://semver.org https://semver.org
- josephg 5y agoThe semver spec implies this, but doesn't say it outright. And that leads to lots of overcomplicated tooling! I'm going to try being even more clear: "Package Foo v1.2.3" should usually be spelled "Package Foo1, v2.3" For example, the migration from react 17.x.x to react 18.x.x is actually a change from depending on package react17 to depending on react18. React17 and react18 are two different packages which have been designed by the same team, and happen to have similar APIs in order to make migration easier. If I designed npm today I'd make "react16", "react17" and "react18" all be essentially different packages (under a namespace). They should probably only share their lists of authorized authors. You can see this confusion all over the place. For example, when setting up peerDependencies in a nodejs project, there are suggestions[1] to use a version like `"chai": ">= 1.5.2 < 2"`. This is because chai v1 and chai v2 are essentially different packages. You want to say "chai v1 should be a peer dependency". But its unintentionally awkward to say that clearly. And with the current nomenclature, there's no way to express a dependency on both chai1 and chai2 - despite them being different, incompatible packages. Even though nodejs is obsessed about semver, it still makes a mess of things by pretending as if major versions and minor versions are similar. They are not. [1] Last couple paragraphs of https://nodejs.org/es/blog/npm/peer-dependencies/ https://nodejs.org/es/blog/npm/peer-dependencies/
- jacobmischka 5y agoWeird that nodejs.org doesn't say so, but that's usually written `"^1.5.2"` and is by far the most common way dependencies are specified in my experience. Cargo even makes the ^ implicit, and you can just write "1.5.2".