New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
badge for required node.js version for npm #237
Comments
That'd be lovely. I found a way to get to the current node version through http://nodejs.org/dist/latest/SHASUMS.txt. By the way, I like your care for color blindness. |
So here's what I have:
What do you think? |
here is the colors i've been using the most recently:
i like the outdated version idea so like if the version range does not include latest version (with the exception of if the range's minimum is above the latest (which would be orange) |
This is a game changer. A totally new product, fitting in a completely new product range. We have been restless in our pursuit of detail. |
sweet, now i don't have to manage the badges manually :) |
thank you sooo much, @espadrine |
And it's live! The website stayed live during the update! I feel like I outperformed an Apple engineer! I'm harsh. Anyway, here it is ☺ |
Sweet. So @rlidwka pointed out the following badge should be giving orange: |
Why should it be orange? It specifies a version range which includes the current node version. |
The current node version is 0.10.31. The range there says |
So from the code in 2dd89e6 it looks like every single badge is going to be green (technically, whatever color the first badge was that was fetched after that cache expired). |
i haven't actually run any code, but looking at how regularUpdate('http://nodejs.org/dist/latest/SHASUMS.txt',
(24 * 3600 * 1000),
function(shasums) {
var firstLine = shasums.slice(0, shasums.indexOf('\n'));
var version = firstLine.split(' ')[1].split('-')[1];
return version;
}, function(err, version) {
if (err != null) { sendBadge(format, badgeData); return; }
if (semver.satisfies(version, versionRange)) {
badgeData.colorscheme = 'brightgreen';
} else if (semver.gtr(version, versionRange)) {
badgeData.colorscheme = 'yellow';
} else {
badgeData.colorscheme = 'orange';
}
sendBadge(format, badgeData);
}); |
Hum, that is very odd… I do get orange on localhost. As for your suggested modification, it is irrelevant. Using constants avoids recomputing the semver information every time. There is possibly a bug with the |
ok? i mean, the
does't the top-level |
Modification authored by @dougwilson Part of issue #237
Aaaah how strange that obvious things stop being obvious at 2am. Thanks and a thousand apologies! |
No problem. I can't thank you enough for taking the time to implement this in the first place :) |
hi! i semi-tried to add this, but since i use windows, it was not easy :) i would like to have a badge that would display the
engine.node
string as a badge. we talked about it a bit here: jshttp/jshttp.github.io#45 this information is available from the npm API, just like the version is. people can specify all kinds of things in there, so i would say echoing out the string should mostly work, but it would be neat if it was smart and had colors based on how many versions you are supporting.The text was updated successfully, but these errors were encountered: