bin-version
Advanced tools
Comparing version 5.0.0 to 6.0.0
@@ -1,10 +0,8 @@ | ||
declare namespace binVersion { | ||
interface Options { | ||
/** | ||
The arguments to pass to `binary` so that it will print its version. | ||
export interface Options { | ||
/** | ||
The arguments to pass to `binary` so that it will print its version. | ||
If not specified, predefined arguments will be used for known binaries, or `['--version']` and `['version']` arguments will be tried. | ||
*/ | ||
readonly args?: readonly string[]; | ||
} | ||
If not specified, predefined arguments will be used for known binaries, or `['--version']` and `['version']` arguments will be tried. | ||
*/ | ||
readonly args?: readonly string[]; | ||
} | ||
@@ -20,27 +18,20 @@ | ||
``` | ||
import binVersion = require('bin-version'); | ||
import binaryVersion from 'bin-version'; | ||
(async () => { | ||
// $ curl --version | ||
// curl 7.30.0 (x86_64-apple-darwin13.0) | ||
// $ curl --version | ||
// curl 7.30.0 (x86_64-apple-darwin13.0) | ||
console.log(await binVersion('curl')); | ||
//=> '7.30.0' | ||
console.log(await binaryVersion('curl')); | ||
//=> '7.30.0' | ||
// $ openssl version | ||
// OpenSSL 1.0.2d 9 Jul 2015 | ||
// $ openssl version | ||
// OpenSSL 1.0.2d 9 Jul 2015 | ||
console.log(await binVersion('openssl')); | ||
//=> '1.0.2' | ||
console.log(await binaryVersion('openssl')); | ||
//=> '1.0.2' | ||
console.log(await binVersion('openssl', {args: ['version']})); | ||
//=> '1.0.2' | ||
})(); | ||
console.log(await binaryVersion('openssl', {args: ['version']})); | ||
//=> '1.0.2' | ||
``` | ||
*/ | ||
declare function binVersion( | ||
binary: string, | ||
options?: binVersion.Options | ||
): Promise<string>; | ||
export = binVersion; | ||
export default function binaryVersion(binary: string, options?: Options): Promise<string>; |
@@ -1,4 +0,3 @@ | ||
'use strict'; | ||
const execa = require('execa'); | ||
const findVersions = require('find-versions'); | ||
import execa from 'execa'; | ||
import findVersions from 'find-versions'; | ||
@@ -21,3 +20,3 @@ const oneMegabyte = 1000 * 1000; | ||
module.exports = async (binary, options = {}) => { | ||
export default async function binaryVersion(binary, options = {}) { | ||
let possibleArguments; | ||
@@ -58,2 +57,2 @@ | ||
throw new Error(`Couldn't find version of \`${binary}\``); | ||
}; | ||
} |
{ | ||
"name": "bin-version", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Get the version of a binary in semver format", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12" | ||
}, | ||
@@ -25,3 +27,2 @@ "scripts": { | ||
"keywords": [ | ||
"bin", | ||
"binary", | ||
@@ -36,9 +37,9 @@ "executable", | ||
"execa": "^5.0.0", | ||
"find-versions": "^4.0.0" | ||
"find-versions": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"ava": "^3.15.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.37.1" | ||
"xo": "^0.39.1" | ||
} | ||
} |
@@ -19,8 +19,6 @@ # bin-version | ||
```js | ||
const binVersion = require('bin-version'); | ||
import binaryVersion from 'bin-version'; | ||
(async () => { | ||
console.log(await binVersion('curl')); | ||
//=> '7.30.0' | ||
})(); | ||
console.log(await binaryVersion('curl')); | ||
//=> '7.30.0' | ||
``` | ||
@@ -34,8 +32,6 @@ | ||
```js | ||
const binVersion = require('bin-version'); | ||
import binaryVersion from 'bin-version'; | ||
(async () => { | ||
console.log(await binVersion('openssl')); | ||
//=> '1.0.2' | ||
})(); | ||
console.log(await binaryVersion('openssl')); | ||
//=> '1.0.2' | ||
``` | ||
@@ -49,8 +45,6 @@ | ||
```js | ||
const binVersion = require('bin-version'); | ||
import binaryVersion from 'bin-version'; | ||
(async () => { | ||
console.log(await binVersion('openssl', {args: ['version']})); | ||
//=> '1.0.2' | ||
})(); | ||
console.log(await binaryVersion('openssl', {args: ['version']})); | ||
//=> '1.0.2' | ||
``` | ||
@@ -60,3 +54,3 @@ | ||
### binVersion(binary, options?) | ||
### binaryVersion(binary, options?) | ||
@@ -63,0 +57,0 @@ Returns a `Promise<string>` with the version of the `binary`. |
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
Yes
5486
74
77
+ Addedfind-versions@5.1.0(transitive)
+ Addedsemver-regex@4.0.5(transitive)
- Removedfind-versions@4.0.0(transitive)
- Removedsemver-regex@3.1.4(transitive)
Updatedfind-versions@^5.0.0