latest-version
Advanced tools
Comparing version 1.0.1 to 2.0.0
11
index.js
'use strict'; | ||
var packageJson = require('package-json'); | ||
module.exports = function (name, cb) { | ||
packageJson(name.toLowerCase(), 'latest', function (err, json) { | ||
if (err) { | ||
cb(err); | ||
return; | ||
} | ||
cb(null, json.version); | ||
module.exports = function (name) { | ||
return packageJson(name.toLowerCase(), 'latest').then(function (data) { | ||
return data.version; | ||
}); | ||
}; |
{ | ||
"name": "latest-version", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Get the latest version of a npm package", | ||
@@ -12,3 +12,2 @@ "license": "MIT", | ||
}, | ||
"bin": "cli.js", | ||
"engines": { | ||
@@ -18,7 +17,6 @@ "node": ">=0.10.0" | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"cli.js" | ||
"index.js" | ||
], | ||
@@ -29,2 +27,3 @@ "keywords": [ | ||
"npm", | ||
"pkg", | ||
"package", | ||
@@ -36,7 +35,13 @@ "package.json", | ||
"dependencies": { | ||
"package-json": "^1.0.0" | ||
"package-json": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"ignores": [ | ||
"test.js" | ||
] | ||
} | ||
} |
@@ -10,3 +10,3 @@ # latest-version [![Build Status](https://travis-ci.org/sindresorhus/latest-version.svg?branch=master)](https://travis-ci.org/sindresorhus/latest-version) | ||
```sh | ||
``` | ||
$ npm install --save latest-version | ||
@@ -19,28 +19,20 @@ ``` | ||
```js | ||
var latestVersion = require('latest-version'); | ||
const latestVersion = require('latest-version'); | ||
latestVersion('pageres', function (err, version) { | ||
latestVersion('ava').then(version => { | ||
console.log(version); | ||
//=> 0.2.3 | ||
//=> '0.2.0' | ||
}); | ||
``` | ||
## CLI | ||
```sh | ||
$ npm install --global latest-version | ||
latestVersion('@sindresorhus/df').then(version => { | ||
console.log(version); | ||
//=> '1.0.1' | ||
}); | ||
``` | ||
```sh | ||
$ latest-version --help | ||
Usage | ||
latest-version <package-name> | ||
## Related | ||
Example | ||
latest-version pageres | ||
0.4.1ersion pageres | ||
0.2.3 | ||
``` | ||
- [latest-version-cli](https://github.com/sindresorhus/latest-version-cli) - CLI for this module | ||
- [package-json](https://github.com/sindresorhus/package-json) - Get the package.json of a package from the npm registry | ||
@@ -47,0 +39,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3095
2
4
7
41
1
+ Addedcapture-stack-trace@1.0.2(transitive)
+ Addedcreate-error-class@3.0.2(transitive)
+ Addedduplexer2@0.1.4(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedgot@5.7.1(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-retry-allowed@1.2.0(transitive)
+ Addednode-status-codes@1.0.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedpackage-json@2.4.0(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedregistry-auth-token@3.4.0(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedtimed-out@3.1.3(transitive)
+ Addedunzip-response@1.0.2(transitive)
+ Addedurl-parse-lax@1.0.0(transitive)
- Removedduplexify@3.7.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedgot@3.3.1(transitive)
- Removedinfinity-agent@2.0.3(transitive)
- Removednested-error-stacks@1.0.2(transitive)
- Removedobject-assign@3.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedpackage-json@1.2.0(transitive)
- Removedstream-shift@1.0.3(transitive)
- Removedtimed-out@2.0.0(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedpackage-json@^2.0.0