You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.1KB

hace 4 años
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # latest-version [![Build Status](https://travis-ci.org/sindresorhus/latest-version.svg?branch=master)](https://travis-ci.org/sindresorhus/latest-version)
  2. > Get the latest version of an npm package
  3. Fetches the version directly from the registry instead of depending on the massive [npm](https://github.com/npm/npm/blob/8b5e7b6ae5b4cd2d7d62eaf93b1428638b387072/package.json#L37-L85) module like the [latest](https://github.com/bahamas10/node-latest) module does.
  4. ## Install
  5. ```
  6. $ npm install latest-version
  7. ```
  8. ## Usage
  9. ```js
  10. const latestVersion = require('latest-version');
  11. (async () => {
  12. console.log(await latestVersion('ava'));
  13. //=> '0.18.0'
  14. console.log(await latestVersion('@sindresorhus/df'));
  15. //=> '1.0.1'
  16. // Also works with semver ranges and dist-tags
  17. console.log(await latestVersion('npm', {version: 'latest-5'}));
  18. //=> '5.5.1'
  19. })();
  20. ```
  21. ## Related
  22. - [latest-version-cli](https://github.com/sindresorhus/latest-version-cli) - CLI for this module
  23. - [package-json](https://github.com/sindresorhus/package-json) - Get the package.json of a package from the npm registry
  24. ## License
  25. MIT © [Sindre Sorhus](https://sindresorhus.com)