@xhmikosr/bin-wrapper 6.0.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +15 -7
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {promises as fs} from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import binCheck from 'bin-check';
|
|
3
|
+
import binCheck from '@xhmikosr/bin-check';
|
|
4
4
|
import binVersionCheck from 'bin-version-check';
|
|
5
5
|
import download from '@xhmikosr/downloader';
|
|
6
6
|
import osFilterObject from 'os-filter-obj';
|
|
@@ -124,7 +124,9 @@ export default class BinWrapper {
|
|
|
124
124
|
runCheck(cmd) {
|
|
125
125
|
return binCheck(this.path(), cmd).then(works => {
|
|
126
126
|
if (!works) {
|
|
127
|
-
throw new Error(
|
|
127
|
+
throw new Error(
|
|
128
|
+
`The "${this.path()}" binary doesn't seem to work correctly`,
|
|
129
|
+
);
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
if (this.version()) {
|
|
@@ -157,7 +159,11 @@ export default class BinWrapper {
|
|
|
157
159
|
const files = osFilterObject(this.src() || []);
|
|
158
160
|
|
|
159
161
|
if (files.length === 0) {
|
|
160
|
-
return Promise.reject(
|
|
162
|
+
return Promise.reject(
|
|
163
|
+
new Error(
|
|
164
|
+
'No binary found matching your system. It\'s probably not supported.',
|
|
165
|
+
),
|
|
166
|
+
);
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
const urls = [];
|
|
@@ -166,10 +172,12 @@ export default class BinWrapper {
|
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
return Promise.all(
|
|
169
|
-
urls.map(url =>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
urls.map(url =>
|
|
176
|
+
download(url, this.dest(), {
|
|
177
|
+
extract: true,
|
|
178
|
+
strip: this.options.strip,
|
|
179
|
+
}),
|
|
180
|
+
),
|
|
173
181
|
).then(result => {
|
|
174
182
|
const resultFiles = result.flatMap((item, index) => {
|
|
175
183
|
if (Array.isArray(item)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xhmikosr/bin-wrapper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Binary wrapper that makes your programs seamlessly available as local dependencies",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "XhmikosR/bin-wrapper",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"wrapper"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@xhmikosr/bin-check": "^5.0.0",
|
|
41
42
|
"@xhmikosr/downloader": "^10.0.2",
|
|
42
|
-
"bin-check": "^4.1.0",
|
|
43
43
|
"bin-version-check": "^5.0.0",
|
|
44
44
|
"os-filter-obj": "^2.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"ava": "^5.3.0",
|
|
48
|
-
"c8": "^7.
|
|
48
|
+
"c8": "^7.14.0",
|
|
49
49
|
"executable": "^4.1.1",
|
|
50
50
|
"nock": "^13.3.1",
|
|
51
51
|
"path-exists": "^5.0.0",
|