bin-version
Advanced tools
Comparing version 4.0.0 to 5.0.0
24
index.js
@@ -5,4 +5,10 @@ 'use strict'; | ||
const oneMegabyte = 1000 * 1000; | ||
const knownBinaryArguments = new Map([ | ||
...['ffmpeg', 'ffprobe', 'ffplay'].map(name => [name, ['-version']]), | ||
...[ | ||
'ffmpeg', | ||
'ffprobe', | ||
'ffplay' | ||
].map(name => [name, ['-version']]), | ||
['openssl', ['version']] | ||
@@ -21,7 +27,3 @@ ]); | ||
const customArgs = knownBinaryArguments.get(binary); | ||
if (customArgs === undefined) { | ||
possibleArguments = defaultPossibleArguments; | ||
} else { | ||
possibleArguments = [customArgs]; | ||
} | ||
possibleArguments = customArgs === undefined ? defaultPossibleArguments : [customArgs]; | ||
} else { | ||
@@ -33,5 +35,9 @@ possibleArguments = [options.args]; | ||
try { | ||
// TODO: Use `{all}` instead of `{stdout, stderr}` when execa v2 is out | ||
const {stdout, stderr} = await execa(binary, args); // eslint-disable-line no-await-in-loop | ||
const [version] = findVersions(stdout || stderr, {loose: true}); | ||
// eslint-disable-next-line no-await-in-loop | ||
const {all} = await execa(binary, args, { | ||
all: true, | ||
maxBuffer: oneMegabyte | ||
}); | ||
const [version] = findVersions(all, {loose: true}); | ||
if (version !== undefined) { | ||
@@ -38,0 +44,0 @@ return version; |
{ | ||
"name": "bin-version", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Get the version of a binary in semver format", | ||
"license": "MIT", | ||
"repository": "sindresorhus/bin-version", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
@@ -32,10 +33,10 @@ "scripts": { | ||
"dependencies": { | ||
"execa": "^1.0.0", | ||
"find-versions": "^3.0.0" | ||
"execa": "^5.0.0", | ||
"find-versions": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.1.0", | ||
"tsd": "^0.7.3", | ||
"xo": "^0.24.0" | ||
"ava": "^2.4.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.37.1" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# bin-version [![Build Status](https://travis-ci.com/sindresorhus/bin-version.svg?branch=master)](https://travis-ci.com/sindresorhus/bin-version) | ||
# bin-version | ||
> Get the version of a binary in [semver](https://github.com/npm/node-semver) format | ||
## Install | ||
@@ -12,3 +11,2 @@ | ||
## Usage | ||
@@ -58,3 +56,2 @@ | ||
## API | ||
@@ -84,3 +81,2 @@ | ||
## Related | ||
@@ -87,0 +83,0 @@ |
Sorry, the diff of this file is not supported yet
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
83
5605
83
+ Addedcross-spawn@7.0.5(transitive)
+ Addedexeca@5.1.1(transitive)
+ Addedfind-versions@4.0.0(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedhuman-signals@2.1.0(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addednpm-run-path@4.0.1(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedsemver-regex@3.1.4(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedstrip-final-newline@2.0.0(transitive)
+ Addedwhich@2.0.2(transitive)
- Removedcross-spawn@6.0.5(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedexeca@1.0.0(transitive)
- Removedfind-versions@3.2.0(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removednice-try@1.0.5(transitive)
- Removednpm-run-path@2.0.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsemver-regex@2.0.0(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedstrip-eof@1.0.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedexeca@^5.0.0
Updatedfind-versions@^4.0.0