Skip to content
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

More specific node version badge? #308

Closed
Martii opened this issue Nov 17, 2014 · 34 comments
Closed

More specific node version badge? #308

Martii opened this issue Nov 17, 2014 · 34 comments
Labels
service-badge New or updated service badge

Comments

@Martii
Copy link

Martii commented Nov 17, 2014

Is it possible to get a full version of node.js in a badge? Currently I'm looking at node badge with 0.10.x... which is better than nothing... but it would be nice to see the .33 that it is currently on.

Thanks in advance and I love these little things... nice work. :)

@espadrine
Copy link
Member

Thanks for this feedback!

Given the current implementation of node badges (its color giving an indication of whether it supports the latest node version), it will be fairly easy to implement that. What do you think the path should be? /node/ve/….svg, for "exact version"?

@Martii
Copy link
Author

Martii commented Nov 17, 2014

What do you think the path should be? /node/ve/….svg, for "exact version"?

I'm not entirely sure on that one... I am not quite sure why this is the only badge that we use that doesn't have the exact so... maybe perhaps nodejs if you want to make it different than node ?

@espadrine
Copy link
Member

That's a fair point. What is displayed is the semver version range, instead of a specific version. Perhaps, to stay consistent, we can have /node/v/ stand for the exact version, and /node/vr/ stand for the version range.

I fear that having both /node/ and /nodejs/ will become confusing.

@dougwilson
Copy link
Contributor

Hm, it would really suck if the behavior of the current badge URLs changed... Originally I asked for this badge because I want to show the semver range, as in "hey, this module works with >= 0.10". Really, showing the exact version doesn't make any sense, because it's not a badge just to show whatever the latest version of Node.js its out, but rather what versions of Node.js your module is compatible with.

@Martii
Copy link
Author

Martii commented Dec 11, 2014

I fear that having both /node/ and /nodejs/ will become confusing.

Looking back in older node releases it used to be called nodejs too. Having both types would be good for both use cases (dispersed dependency check to see if a project is out of date in development versus production as compared to eye-candy for a range of support) especially for those classicly glued to it's original use. The 0.10.x can easily be checked in a projects compatibility with the engines named key. As it sits now the 0.10.x isn't accurate for those specifying something like a semver of "node": ">=0.10.33". The naming of the URI route/path is just the hard part I think. :)

@dougwilson
Copy link
Contributor

As it sits now the 0.10.x isn't accurate for those specifying something like a semver of "node": ">=0.10.33".

So... "0.10.x" is a semver range. It expands to >= 0.10.0 < 0.11. I mean, the badge just reflects whatever the author of the package choose to use. If the author only wanted their package to be installable on Node.js 0.10 (and not 0.9, nor 0.11), that's up to the author.

Besides, replacing the badge to list whatever the latest stable version of Node.js that fits in the rage is not useful here. I use the badge all over my projects, which have their node engine set to >= 0.8 or >= 0.6; having those badges suddenly read 0.10.33 would be absolutely useless.

@Martii you can ask for a new badge for this, please, just don't alter the one that already exists.

@Martii
Copy link
Author

Martii commented Dec 11, 2014

@Martii you can ask for a new badge for this, please, just don't alter the one that already exists.

@dougwilson

Is it possible to get a full version of node.js in a badge?

... maybe perhaps nodejs if you want to make it different than node ?

e.g. you are asking the wrong person here and may want to give my responses another go around please. :)


Besides, replacing the badge to list whatever the latest stable version of Node.js that fits in the ra_(n)_ge is not useful here

That's precisely what the current node badge does... so you just stated it wasn't useful. ;)


@espadrine

... eye-candy for a range of support ...

In regards to this... if there were a generic badge that someone could send the strings out in the URI and have it customized that would solve the eye-candy bit for those who needed that. e.g. perhaps something along the lines of http://img.shields.io/custom/node/0.10.x.svg could generate the text of node on the left and the 0.10.x on the right. (another generalized example http://img.shields.io/custom/foo/0.7.x.svg would gen a foo on the left and the 0.7.x on the right). I don't know how the colors would come into play but just a thought.

@dougwilson
Copy link
Contributor

Besides, replacing the badge to list whatever the latest stable version of Node.js that fits in the ra(n)ge is not useful here

That's precisely what the current node badge does... so you just stated it wasn't useful. ;)

No, it's not what the current badge does. Here is my version badge from a project: Version It doesn't do anything with the current version of Node.js, just echos my node engine semver range from my package.json.

@dougwilson
Copy link
Contributor

The badge you have in your original post is displaying the engines value from the npm package gh-badges (https://www.npmjs.com/package/gh-badges), which they have set to 0.10.x. Why are you displaying the version of Node.js the gh-badges module works with on https://github.com/Martii/OpenUserJS.org ?

@Martii
Copy link
Author

Martii commented Dec 11, 2014

Why are you displaying the version of Node.js the gh-badges

That's what I'm looking into right now. The URI format isn't exactly documented so a lot was copy/paste and trying to figure things out by trial and error... in this case what you are saying is err. :)

That's nice that a shield route can read the package.json but it will still be nice to have a more specific node.js badge that actually validates against the current release of node as I mentioned in the very first post.

@dougwilson
Copy link
Contributor

Basically to boil it down for you, the URL http://img.shields.io/node/v/<npmpackage>.svg displays the value of the engines spec in the npm package <npmpackage>'s package.json.

For example, if I put in etag, this is the Node.js badge for the npm etag module: version
If it put in gh-badges, this is the Node.js badge for the gh-badges module: version

The URL http://img.shields.io/node/v/<npmpackage>.svg has nothing to do with displaying what version of Node.js is out.

@dougwilson
Copy link
Contributor

That's what I'm looking into right now. The URI format isn't exactly documented so a lot was copy/paste and trying to figure things out by trial and error... in this case what you are saying is err. :)

You're displaying a badge for the gh-badges project, not your project or even the Node.js project....

@dougwilson
Copy link
Contributor

That's nice that a shield route can read the package.json but it will still be nice to have a more specific node.js badge that actually validates against the current release of node as I mentioned in the very first post.

Right. I'm just trying to say it's something that would be completely different from the URL http://img.shields.io/node/v/<npmpackage>.svg, since that is for displaying the version of Node.js a npm package works against. You're asking for something completely new: a badge that shows what the latest stable version of Node.js is. Yes, there is no such badge as this.

Node.js is not published anywhere, The only URL that would make sense to put your request under would be http://img.shields.io/node.svg

@espadrine
Copy link
Member

@Martii

if there were a generic badge that someone could send the strings out in the URI and have it customized that would solve the eye-candy bit for those who needed that. e.g. perhaps something along the lines of http://img.shields.io/custom/node/0.10.x.svg could generate the text of node on the left and the 0.10.x on the right. (another generalized example http://img.shields.io/custom/foo/0.7.x.svg would gen a foo on the left and the 0.7.x on the right). I don't know how the colors would come into play but just a thought.

Are you looking for something like http://img.shields.io/badge/node-0.10.x-brightgreen.svg?

You have more information about this at the bottom of the website, shields.io.

@espadrine
Copy link
Member

I don't intend on changing the semantics of http://img.shields.io/node/v/<npmpackage>.svg.

The color of the badge indicates whether the latest node version is supported. Green means yes.

Is there a use-case this doesn't cover?

@Martii
Copy link
Author

Martii commented Dec 11, 2014

Node.js is not published anywhere...

Confirmed... which is why it would useful for our project to have a route validate against https://nodejs.org or even their GitHub branch of 0.10.x to see what the latest stable is. Our project should never be published on npmjs.org so I don't think we'd ever have a badge.

Are you looking for something like ...

http://img.shields.io/badge/node-0.10.33-brightgreen.svg appears to work but that doesn't seem to validate against node branch e.g. we have to specify it to be 0.10.33.

@dougwilson
Copy link
Contributor

I don't intend on changing the semantics of http://img.shields.io/node/v/.svg.

Cool, that's what I was scared about.

Is there a use-case this doesn't cover?

So, I figured out what @Martii wants: not a badge that shows what version of Node.js a npm module is compatible with, but rather a badge that literally just shows what the latest version of Node.js is out, nothing to do with npm modules.

@Martii
Copy link
Author

Martii commented Dec 11, 2014

but rather a badge that literally just shows what the latest version of Node.js is out

Yes... which leads back to my initial post even though I was using a package reference with the image... striking out shortly.

@dougwilson
Copy link
Contributor

Hm, sadly the Node.js GitHub project doesn't uses GitHub releases otherwise you could use https://img.shields.io/github/release/joyent/node.svg i

From looking over the different sources supported, it would mean the Node.js badge @Martii is looking for would be some kind of one-off thing; a badge that only does one thing: displays the latest version of Node.js from http://nodejs.org/dist/latest/SHASUMS.txt

@Martii
Copy link
Author

Martii commented Dec 11, 2014

... the Node.js GitHub project doesn't uses GitHub releases ...

They don't?

@GrahamCampbell
Copy link

No they don't. They use tags. That's different.

@espadrine
Copy link
Member

What I use to fetch the latest node version is http://nodejs.org/dist/latest/SHASUMS.txt. It produces either a green color if the latest version is supported, or a yellow color if it isn't.

If you want, I can make a badge, say, /node/latest.svg, whose sole purpose is to show the latest node version released. I don't see the point, but I can do it. Of course, this may become obsolete very soon due to the fork.

@Martii
Copy link
Author

Martii commented Dec 11, 2014

The color of the badge indicates whether the latest node version is supported. Green means yes.

So we have a bunch of orange and blue on the other packages... but I know that all of them are supported in the latest stable release of node... did I miss the point here again?

@espadrine
Copy link
Member

@Martii The badges shown here are npm: they show the exact npm version of those packages, not the supported node version range. Orange means "initial development" in the semver definition.

@Martii
Copy link
Author

Martii commented Dec 11, 2014

@espadrine
ahh okay then that explains that tangent. Thanks for these explanations. I did read all documentation but it was still a bit vague in my mind on some of the discussed things here. :)

So showing the exact node stable release badge would be a kewl addition ... I am gathering that this doesn't exist yet from all these replies.

I'm also contemplating making a user.js to read in our package.json and display those along side with npm's release versions just as an automatic visual cue check... basically what David does externally but instant/ondemand instead of delayed/watched... and what I do manually daily.

@espadrine
Copy link
Member

I suggest http://img.shields.io/node/latest-version.svg then.

http://img.shields.io/node/latest-version.svg

@Martii
Copy link
Author

Martii commented Dec 11, 2014

@espadrine

I suggest http://img.shields.io/node/latest-version.svg then.

So does that exist? ... or are you suggesting the new route?

Currently get:

<title>These aren't the pages you're looking for</title>

I have nothing to offer for this request

… but blood, toil, tears and sweat.

Fortunately, the main page can offer rainbows instead!

(You probably landed on this page because a link was broken, because someone mistyped its URL, or because of an irrelevant mistake. Don't worry, though: there is all of the rest of the Web to explore!)

btw LOL ;)

@Martii
Copy link
Author

Martii commented Dec 11, 2014

Just a sidenote too nodejs is above 0.10.x but not in stable though... so not sure if "latest-version" would be accurate enough... e.g. "latest-stable" might be better I think.

@espadrine
Copy link
Member

iojs will start going the semver way, so there is no stable version yet.

@paulmelnikow paulmelnikow added the service-badge New or updated service badge label Apr 18, 2017
@danday74
Copy link

danday74 commented Jul 22, 2017

Since no-one has covered this here the format for engines in package.json is ...

"engines": {
"node": ">= 0.6"
}

when using ...

https://img.shields.io/node/v/<YOUR_PACKAGE>.svg

@Martii
Copy link
Author

Martii commented Jul 22, 2017

  1. package.json may not always be on npmjs.com ... which is a related issue. The private bit may be set in which case it won't be on npmjs.com
  2. More dynamic detection of a specific latest version, say 6.x, showing the latest version there is what is needed as alluded to with the engines property in the prior reply.

It's okay if it doesn't get done as the syntax was already mentioned as not changing... although another virtual field/parameter could be possible perhaps with the example of http://img.shields.io/badge/node-v0.10.33-orange.svg becoming http://img.shields.io/badge/node-v0.10.latest-orange.svg which could show the last (latest) version of that node version. e.g. a buzz word of latest invoking some process of finding it. In our case we would need in our README.md a value of something like http://img.shields.io/badge/node-v6.0.latest-orange.svg. As it sits right now we go visit https://nodejs.org/en/docs/ and see what it is with a click through.

@paulmelnikow
Copy link
Member

Think this should be resolved by our existing node version support, updated in #1144, and our badge which pulls data from package.json on github, added in #739.

If there's something further we should do, would someone please open a new issue?

@paulmelnikow
Copy link
Member

paulmelnikow commented Oct 13, 2017

That PR is waiting for deploy. To see when that happens, you can keep an eye on https://github.com/badges/shields/tree/gh-pages.

I just pushed the latest to the staging server:

  • https://shields-staging.herokuapp.com/node/v/passport.svg
  • https://shields-staging.herokuapp.com/node/v/@stdlib/stdlib.svg
  • https://shields-staging.herokuapp.com/node/v/passport/latest.svg
  • https://shields-staging.herokuapp.com/node/v/@stdlib/stdlib/latest.svg

The server doesn't have the right font installed which is why the letter spacing is off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

No branches or pull requests

6 participants