@delta-infra/cli 1.0.36 → 1.0.37
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/package.json +1 -1
- package/scripts/install.js +11 -0
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -98,6 +98,7 @@ var _MIRROR_LIST = [
|
|
|
98
98
|
// Quick connectivity check: fetch a small file (checksums.txt) from each
|
|
99
99
|
// mirror and return only the ones that respond within the probe timeout.
|
|
100
100
|
function probeMirrors(version, cb) {
|
|
101
|
+
console.error("Probing " + _MIRROR_LIST.length + " download mirrors...");
|
|
101
102
|
var probeUrl = "/https://github.com/" + REPO + "/releases/download/v" + version + "/checksums.txt";
|
|
102
103
|
var results = [];
|
|
103
104
|
var pending = _MIRROR_LIST.length;
|
|
@@ -106,6 +107,11 @@ function probeMirrors(version, cb) {
|
|
|
106
107
|
function finish() {
|
|
107
108
|
if (done) return;
|
|
108
109
|
done = true;
|
|
110
|
+
if (results.length > 0) {
|
|
111
|
+
console.error("Found " + results.length + " available mirror(s)");
|
|
112
|
+
} else {
|
|
113
|
+
console.error("No mirror responded, falling back to GitHub source");
|
|
114
|
+
}
|
|
109
115
|
cb(results);
|
|
110
116
|
}
|
|
111
117
|
|
|
@@ -324,6 +330,7 @@ function install() {
|
|
|
324
330
|
console.error("Downloading from " + downloadUrls[i]);
|
|
325
331
|
download(downloadUrls[i], archivePath);
|
|
326
332
|
downloaded = true;
|
|
333
|
+
console.error("Download complete, verifying...");
|
|
327
334
|
break;
|
|
328
335
|
} catch (e) {
|
|
329
336
|
console.error("Failed: " + e.message);
|
|
@@ -334,10 +341,13 @@ function install() {
|
|
|
334
341
|
|
|
335
342
|
const expectedHash = getExpectedChecksum(archiveName);
|
|
336
343
|
verifyChecksum(archivePath, expectedHash);
|
|
344
|
+
console.error("Checksum verified");
|
|
337
345
|
|
|
338
346
|
if (isWindows) {
|
|
347
|
+
console.error("Extracting archive...");
|
|
339
348
|
extractZipWindows(archivePath, tmpDir);
|
|
340
349
|
} else {
|
|
350
|
+
console.error("Extracting archive...");
|
|
341
351
|
execFileSync("tar", ["-xzf", archivePath, "-C", tmpDir], { stdio: "ignore" });
|
|
342
352
|
}
|
|
343
353
|
|
|
@@ -361,6 +371,7 @@ function install() {
|
|
|
361
371
|
}
|
|
362
372
|
}
|
|
363
373
|
fs.chmodSync(dest, 0o755);
|
|
374
|
+
console.error("Installed to " + dest);
|
|
364
375
|
} finally {
|
|
365
376
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
366
377
|
}
|