@delta-infra/cli 1.0.36 → 1.0.38
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 +14 -4
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
|
|
|
@@ -323,21 +329,24 @@ function install() {
|
|
|
323
329
|
try {
|
|
324
330
|
console.error("Downloading from " + downloadUrls[i]);
|
|
325
331
|
download(downloadUrls[i], archivePath);
|
|
332
|
+
console.error("Download complete, verifying checksum...");
|
|
333
|
+
const expectedHash = getExpectedChecksum(archiveName);
|
|
334
|
+
verifyChecksum(archivePath, expectedHash);
|
|
335
|
+
console.error("Checksum verified");
|
|
326
336
|
downloaded = true;
|
|
327
337
|
break;
|
|
328
338
|
} catch (e) {
|
|
329
|
-
console.error("Failed: " + e.message);
|
|
339
|
+
console.error("Failed: " + e.message + " (" + downloadUrls[i] + ")");
|
|
330
340
|
lastErr = e;
|
|
331
341
|
}
|
|
332
342
|
}
|
|
333
343
|
if (!downloaded) throw lastErr;
|
|
334
344
|
|
|
335
|
-
const expectedHash = getExpectedChecksum(archiveName);
|
|
336
|
-
verifyChecksum(archivePath, expectedHash);
|
|
337
|
-
|
|
338
345
|
if (isWindows) {
|
|
346
|
+
console.error("Extracting archive...");
|
|
339
347
|
extractZipWindows(archivePath, tmpDir);
|
|
340
348
|
} else {
|
|
349
|
+
console.error("Extracting archive...");
|
|
341
350
|
execFileSync("tar", ["-xzf", archivePath, "-C", tmpDir], { stdio: "ignore" });
|
|
342
351
|
}
|
|
343
352
|
|
|
@@ -361,6 +370,7 @@ function install() {
|
|
|
361
370
|
}
|
|
362
371
|
}
|
|
363
372
|
fs.chmodSync(dest, 0o755);
|
|
373
|
+
console.error("Installed to " + dest);
|
|
364
374
|
} finally {
|
|
365
375
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
366
376
|
}
|