Today, around 5PM UDT, I played with npm view both with CLI and programmatic API and I got some strange results... Running npm view npm inside my shell returned (lot of stuff removed):
{ name: 'npm',
description: 'a package manager for JavaScript',
'dist-tags': { latest: '2.11.1', next: '2.11.2' },
versions:
[ ...,
'2.11.0',
'2.11.1',
'2.11.2' ],
maintainers: [...],
time:
{ modified: '2015-06-05T00:54:40.257Z',
created: '2013-07-12T18:32:48.902Z',
...,
'2.11.0': '2015-05-22T06:09:54.035Z',
'2.11.1': '2015-05-28T21:36:47.566Z',
'2.11.2': '2015-06-05T00:54:40.257Z' },
dist:
{ shasum: '6197c1520e8b9110c34b0b6841175fea551e2ecf',
tarball: 'http://registry.npmjs.org/npm/-/npm-2.11.1.tgz' } }
And running the following code to display the last NPM version:
var npm = require('npm');
npm.load({}, function () {
npm.commands.view(['npm'], false, function (err, infos) {
if (err) { console.log(err); }
else { console.log(infos); }
});
});
Output the same stuff as before assigned to a 2.11.1 key.
{ "2.11.1": {... same stuff as before...}}
So, here is the question. Maybe I got it wrong, but why is 2.11.1 considered the last version (both in npm.commands.view and in the dist-tags object) even if a 2.11.2 has been created (both in versions array and time object)?
Checking NPM website confirm the 2.11.1 as the last version. But I can actually install 2.11.2 by running npm install npm@2.11.2.
Is that linked to the fact that it's a pre-release on GitHub? Or because it was published with a tag different than latest?
Why is it bothering me? Because I'm trying to figure the best version of a package to install but I got a conflict: if I have npm: ^2.11.0 inside my package.json, checking the best version according to SEMVER inside the versions array will return me 2.11.2 but this version is supposed to be greater than the last version 2.11.1 so it's kind of not really valid. And so my head just exploded...
Thanks a lot for any help!
Today, around 5PM UDT, I played with
npm viewboth with CLI and programmatic API and I got some strange results... Runningnpm view npminside my shell returned (lot of stuff removed):And running the following code to display the last NPM version:
Output the same stuff as before assigned to a
2.11.1key.So, here is the question. Maybe I got it wrong, but why is
2.11.1considered the last version (both innpm.commands.viewand in thedist-tagsobject) even if a2.11.2has been created (both inversionsarray andtimeobject)?Checking NPM website confirm the
2.11.1as the last version. But I can actually install2.11.2by runningnpm install npm@2.11.2.Is that linked to the fact that it's a pre-release on GitHub? Or because it was published with a tag different than
latest?Why is it bothering me? Because I'm trying to figure the best version of a package to install but I got a conflict: if I have
npm: ^2.11.0inside mypackage.json, checking the best version according to SEMVER inside theversionsarray will return me2.11.2but this version is supposed to be greater than the last version2.11.1so it's kind of not really valid. And so my head just exploded...Thanks a lot for any help!