question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Named snapshot versions have semver sorting conflicts

See original GitHub issue

Affected Packages

  • "@changesets/cli": "^2.22.0"

Problem

I’ve recently published multiple snapshot versions with different names, and tried to update from one to the other. My package manager (yarn classic) failed to install the newer transitive snapshot version, because the previous one’s name was considered newer. This is probably because the named versions are ordered alphabetically.

From this example, you can see that even though the snapshot with name “semantic-colors” has the latest timestamp, it is ordered to be lower than the older “theme-provider” snapshot. https://semvercompare.azurewebsites.net/?version=0.0.0-semantic-colors-20220527130647&version=0.0.0-theme-provider-20220526071429

Proposed solution

Reverse the order of the timestamp and snapshot name in the version. The following example has the timestamp and name switched and the versions are ordered correctly: https://semvercompare.azurewebsites.net/?version=0.0.0-20220527130647-semantic-colors&version=0.0.0-20220526071429-theme-provider

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mihkeleidastcommented, Aug 1, 2022

This seems to be fixed by now, versions are without caret and some sort of templating is also possible, I believe.

1reaction
Andaristcommented, Jun 1, 2022

This seems like the more correct solution. Is there a way to make snapshot versioning do this, or is it the real issue that should be fixed?

I would probably accept a PR implementing this as a default for snapshot releases 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Semantic Versioning 2.0.0 | Semantic Versioning
Semantic Versioning 2.0.0. Summary. Given a version number MAJOR.MINOR.PATCH, increment the: MAJOR version when you make incompatible API changes ...
Read more >
conflict between a hyphen (-) in the version and rpmbuild #145
This seems to point to a conflict between a rather natural way of doing RPM specs and semver. I wonder how other people...
Read more >
Versioning Guidelines - Fedora Docs
Handling non-sorting versions with tilde, dot, and caret; Snapshots; Upstream has never chosen a version; Upstream uses invalid characters in the version ......
Read more >
git - Using Gitflow and Semantic Versioning: How to avoid ...
In gitflow, you bump version numbers on every release or hotfix branch. This inevitably leads to version conflicts if a new development cycle...
Read more >
7 Understanding Maven Version Numbers - Oracle Help Center
The SNAPSHOT dependency is refetched, on a developer's machine or it is updated in every build. This ensures that dependencies are updated and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found