latest-version
Advanced tools
Comparing version 8.0.0 to 9.0.0
@@ -1,8 +0,7 @@ | ||
export type Options = { | ||
/** | ||
A semver range or [dist-tag](https://docs.npmjs.com/cli/dist-tag). | ||
*/ | ||
readonly version?: string; | ||
}; | ||
import type {Options as PackageJsonOptions} from 'package-json'; | ||
export {PackageNotFoundError, VersionNotFoundError} from 'package-json'; | ||
export type Options = Pick<PackageJsonOptions, 'version' | 'registryUrl' | 'omitDeprecated'>; | ||
/** | ||
@@ -16,12 +15,12 @@ Get the latest version of an npm package. | ||
console.log(await latestVersion('ava')); | ||
//=> '0.18.0' | ||
//=> '6.1.1' | ||
console.log(await latestVersion('@sindresorhus/df')); | ||
//=> '1.0.1' | ||
//=> '4.0.0' | ||
// Also works with semver ranges and dist-tags | ||
console.log(await latestVersion('npm', {version: 'latest-5'})); | ||
//=> '5.5.1' | ||
//=> '5.10.0' | ||
``` | ||
*/ | ||
export default function latestVersion(packageName: string, options?: Options): Promise<string>; |
import packageJson from 'package-json'; | ||
export {PackageNotFoundError, VersionNotFoundError} from 'package-json'; | ||
export default async function latestVersion(packageName, options) { | ||
@@ -4,0 +6,0 @@ const {version} = await packageJson(packageName.toLowerCase(), options); |
{ | ||
"name": "latest-version", | ||
"version": "8.0.0", | ||
"version": "9.0.0", | ||
"description": "Get the latest version of an npm package", | ||
@@ -40,11 +40,11 @@ "license": "MIT", | ||
"dependencies": { | ||
"package-json": "^9.0.0" | ||
"package-json": "^10.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^6.1.0", | ||
"semver": "^7.5.4", | ||
"ava": "^6.1.1", | ||
"semver": "^7.6.0", | ||
"semver-regex": "^4.0.5", | ||
"tsd": "^0.30.4", | ||
"xo": "^0.56.0" | ||
"tsd": "^0.30.7", | ||
"xo": "^0.57.0" | ||
} | ||
} |
@@ -19,12 +19,14 @@ # latest-version | ||
console.log(await latestVersion('ava')); | ||
//=> '0.18.0' | ||
//=> '6.1.1' | ||
console.log(await latestVersion('@sindresorhus/df')); | ||
//=> '1.0.1' | ||
//=> '4.0.0' | ||
// Also works with semver ranges and dist-tags | ||
console.log(await latestVersion('npm', {version: 'latest-5'})); | ||
//=> '5.5.1' | ||
//=> '5.10.0' | ||
``` | ||
This package exposes the [`version`](https://github.com/sindresorhus/package-json#version), [`registryUrl`](https://github.com/sindresorhus/package-json#registryurl), and [`omitDeprecated`](https://github.com/sindresorhus/package-json#omitdeprecated) options from [`package-json`](https://github.com/sindresorhus/package-json#options), as well as the [`PackageNotFoundError`](https://github.com/sindresorhus/package-json#packagenotfounderror) and [`VersionNotFoundError`](https://github.com/sindresorhus/package-json#versionnotfounderror) errors. | ||
## Related | ||
@@ -31,0 +33,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
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
4443
35
24
+ Addedky@1.7.2(transitive)
+ Addedpackage-json@10.0.1(transitive)
- Removed@sindresorhus/is@5.6.0(transitive)
- Removed@szmarczak/http-timer@5.0.1(transitive)
- Removed@types/http-cache-semantics@4.0.4(transitive)
- Removedcacheable-lookup@7.0.0(transitive)
- Removedcacheable-request@10.2.14(transitive)
- Removeddecompress-response@6.0.0(transitive)
- Removeddefer-to-connect@2.0.1(transitive)
- Removedform-data-encoder@2.1.4(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedgot@13.0.0(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp2-wrapper@2.2.1(transitive)
- Removedjson-buffer@3.0.1(transitive)
- Removedkeyv@4.5.4(transitive)
- Removedlowercase-keys@3.0.0(transitive)
- Removedmimic-response@3.1.04.0.0(transitive)
- Removednormalize-url@8.0.1(transitive)
- Removedp-cancelable@3.0.0(transitive)
- Removedpackage-json@9.0.0(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedresolve-alpn@1.2.1(transitive)
- Removedresponselike@3.0.0(transitive)
Updatedpackage-json@^10.0.0