nuts
nuts copied to clipboard
Strip channel when calling semver.satisfies to allow custom channels
The semver
packages doesn't seem to have any problems dealing with custom channels when calling gt
:
> semver.gt('v0.14.1-canary', 'v0.14.0-canary')
true
But satisfies
doesn't seem to support them:
> semver.satisfies('v0.14.1-canary', '>=v0.14.0-canary')
false
As a result, nuts always returns HTTP 204 for URLs like:
curl "http://nuts-canary.itch.ovh/update/darwin_x64/0.14.0-canary"
This patch strips the channel before calling semver.satisfies
, which fixes the issue for us.
Sorry for the delay.
I'm not sure it's a "good" idea. I understand the problem (I'm having it with semver and gitbook-cli/gitbook).
But here are the expectations: for our application:
// We want to ship the next beta (or normal) to user having the beta
satisfies('>=5.0.0-beta.0', '5.0.0-beta.1') == true
satisfies('>=5.0.0-beta.0', '5.0.1') == true
// We don't want to ship the beta to user using the normal version
satisfies('>=4.9.0', '5.0.0-beta.1') == false
I think that your PR will break this behaviour, since:
satisfies('>=4.9.0', '5.0.0-beta.1') -> satisfies('>=4.9.0', '5.0.0') -> true
I agree that it might not be a good idea for everyone.
Personally, I've set up 'unstable' release in a completely different github repo, with a different nuts instance, everything different — I wanted it to be invisible to most users & have the deploy process not touch the main repo at all.
Both approaches have drawbacks, tbh. Do you think there's a way to support both with an option without making the code too complex/costly to maintain? It is a very small patch but as a maintainer I'd completely understand if you'd rather not support it in your version.
Some more clarity on the matter
https://github.com/npm/node-semver#prerelease-tags
Are there any plans to be able to opt-in for updates to very early channels like Alpha? It would be useful to be able to push updates to QA as they come.
Hi, I merged the project to a new repo to start maintain it, I would be glad if you can put your pull request here : https://github.com/loprima-l/nuts-2