/semver.io

semver range resolution as a service

Primary LanguageCoffeeScriptMIT LicenseMIT

semver.io

semver.io is a plaintext and JSON webservice that tracks all available versions of node.js and nginx. It uses that version info to resolve semver range queries. It's used by Heroku's node buildpack and is open-sourced on GitHub.

On the command line

### For nodejs
curl https://semver.io/node/stable
# {{node:current_stable_version}}

curl https://semver.io/node/unstable
# {{node:current_unstable_version}}

curl https://semver.io/node/resolve/0.8.x
# 0.8.26

### For nginx
curl https://semver.io/nginx/stable
# {{nginx:current_stable_version}}

In the browser

There's also a CORS-friendly HTTP endpoint at semver.io/node.json and semver.io/nginx.json that gives you the whole kit and caboodle:

  var xhr = new XMLHttpRequest();
  xhr.open('GET', 'https://semver.io/node.json', true);
  xhr.onload = function () { console.log(xhr.responseText); };
  xhr.send();

The response is something like:

{
  "stable": "0.10.22",
  "unstable": "0.11.8",
  "versions": [
    "0.8.6",
    "...",
    "0.11.9"
  ]
}

Ranges

semver.io supports any range that isaacs/node-semver can parse. Here are some examples (these also work for nginx):

These named routes are also provided for convenience:

How does it work?

Under the hood, semver.io is powered by node-version-resolver, a node module that does all the work of talking to nodejs.org and parsing version data.

For nginx, it parses nginx's tarball filenames from nginx.org/download and extract the versions available.

While currently implemented for node and nginx, semver.io is designed to support any software that follows the semver rules.

What about npm versions?

npm versions are not tracked because the node binary has shipped with npm included since node 0.6.3. The buildpack ignores engines.npm, deferring to node for npm version resolution.

Links