@xhmikosr/bin-wrapper 13.2.0 → 14.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 +12 -23
- package/package.json +10 -11
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {promises as fs} from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import binCheck from '@xhmikosr/bin-check';
|
|
4
|
-
import
|
|
4
|
+
import binaryVersionCheck from 'binary-version-check';
|
|
5
5
|
import download from '@xhmikosr/downloader';
|
|
6
6
|
import osFilterObject from '@xhmikosr/os-filter-obj';
|
|
7
7
|
|
|
@@ -121,13 +121,11 @@ export default class BinWrapper {
|
|
|
121
121
|
runCheck(cmd) {
|
|
122
122
|
return binCheck(this.path(), cmd).then(works => {
|
|
123
123
|
if (!works) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
`The "${this.path()}" binary doesn't seem to work correctly`,
|
|
126
|
-
);
|
|
124
|
+
throw new Error(`The "${this.path()}" binary doesn't seem to work correctly`);
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
if (this.version()) {
|
|
130
|
-
return
|
|
128
|
+
return binaryVersionCheck(this.path(), this.version());
|
|
131
129
|
}
|
|
132
130
|
});
|
|
133
131
|
}
|
|
@@ -156,25 +154,18 @@ export default class BinWrapper {
|
|
|
156
154
|
const files = osFilterObject(this.src() || []);
|
|
157
155
|
|
|
158
156
|
if (files.length === 0) {
|
|
159
|
-
return Promise.reject(
|
|
160
|
-
new Error(
|
|
161
|
-
'No binary found matching your system. It\'s probably not supported.',
|
|
162
|
-
),
|
|
163
|
-
);
|
|
157
|
+
return Promise.reject(new Error('No binary found matching your system. It\'s probably not supported.'));
|
|
164
158
|
}
|
|
165
159
|
|
|
166
160
|
const urls = files.map(file => file.url);
|
|
167
161
|
|
|
168
|
-
return Promise.all(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}),
|
|
176
|
-
),
|
|
177
|
-
).then(result => {
|
|
162
|
+
return Promise.all(urls.map(url =>
|
|
163
|
+
download(url, this.dest(), {
|
|
164
|
+
extract: true,
|
|
165
|
+
decompress: {
|
|
166
|
+
strip: this.options.strip,
|
|
167
|
+
},
|
|
168
|
+
}))).then(result => {
|
|
178
169
|
const resultFiles = result.flatMap((item, index) => {
|
|
179
170
|
if (Array.isArray(item)) {
|
|
180
171
|
return item.map(file => file.path);
|
|
@@ -186,9 +177,7 @@ export default class BinWrapper {
|
|
|
186
177
|
return parsedPath.base;
|
|
187
178
|
});
|
|
188
179
|
|
|
189
|
-
return Promise.all(
|
|
190
|
-
resultFiles.map(file => fs.chmod(path.join(this.dest(), file), 0o755)),
|
|
191
|
-
);
|
|
180
|
+
return Promise.all(resultFiles.map(file => fs.chmod(path.join(this.dest(), file), 0o755)));
|
|
192
181
|
});
|
|
193
182
|
}
|
|
194
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xhmikosr/bin-wrapper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Binary wrapper that makes your programs seamlessly available as local dependencies",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"url": "https://github.com/kevva"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=20"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"ava": "ava",
|
|
@@ -41,19 +41,18 @@
|
|
|
41
41
|
"wrapper"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@xhmikosr/bin-check": "^
|
|
45
|
-
"@xhmikosr/downloader": "^
|
|
44
|
+
"@xhmikosr/bin-check": "^8.0.0",
|
|
45
|
+
"@xhmikosr/downloader": "^16.0.1",
|
|
46
46
|
"@xhmikosr/os-filter-obj": "^3.0.0",
|
|
47
|
-
"
|
|
47
|
+
"binary-version-check": "^6.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"ava": "
|
|
50
|
+
"ava": "^6.4.1",
|
|
51
51
|
"c8": "^10.1.3",
|
|
52
|
-
"isexe": "^
|
|
53
|
-
"nock": "^14.0.
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"xo": "^0.60.0"
|
|
52
|
+
"isexe": "^4.0.0",
|
|
53
|
+
"nock": "^14.0.11",
|
|
54
|
+
"tempy": "^3.2.0",
|
|
55
|
+
"xo": "^1.2.3"
|
|
57
56
|
},
|
|
58
57
|
"xo": {
|
|
59
58
|
"rules": {
|