@xhmikosr/bin-wrapper 14.2.5 → 14.3.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 -5
- package/package.json +1 -1
- package/readme.md +4 -0
package/index.js
CHANGED
|
@@ -107,6 +107,15 @@ export default class BinWrapper {
|
|
|
107
107
|
return path.join(this.dest(), this.use());
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Get the source URLs matching the current OS and arch
|
|
112
|
+
*
|
|
113
|
+
* @returns {string[]}
|
|
114
|
+
*/
|
|
115
|
+
resolvedUrls() {
|
|
116
|
+
return osFilterObject(this.src() || []).map(file => file.url);
|
|
117
|
+
}
|
|
118
|
+
|
|
110
119
|
/**
|
|
111
120
|
* Check for the binary and download it if missing, then optionally verify it works.
|
|
112
121
|
*
|
|
@@ -166,14 +175,12 @@ export default class BinWrapper {
|
|
|
166
175
|
* @api private
|
|
167
176
|
*/
|
|
168
177
|
async download() {
|
|
169
|
-
const
|
|
178
|
+
const urls = this.resolvedUrls();
|
|
170
179
|
|
|
171
|
-
if (
|
|
180
|
+
if (urls.length === 0) {
|
|
172
181
|
throw new Error('No binary found matching your system. It\'s probably not supported.');
|
|
173
182
|
}
|
|
174
183
|
|
|
175
|
-
const urls = files.map(file => file.url);
|
|
176
|
-
|
|
177
184
|
const results = await Promise.all(urls.map(url =>
|
|
178
185
|
downloader(url, this.dest(), {
|
|
179
186
|
extract: true,
|
|
@@ -187,7 +194,7 @@ export default class BinWrapper {
|
|
|
187
194
|
return item.map(file => file.path);
|
|
188
195
|
}
|
|
189
196
|
|
|
190
|
-
const parsedUrl = new URL(
|
|
197
|
+
const parsedUrl = new URL(urls[index]);
|
|
191
198
|
|
|
192
199
|
return path.parse(parsedUrl.pathname).base;
|
|
193
200
|
});
|
package/package.json
CHANGED
package/readme.md
CHANGED