@volcengine/cli 1.0.39 → 1.0.42
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/install.js +31 -18
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -5,7 +5,7 @@ const https = require("https");
|
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
|
|
8
|
-
const VERSION = "1.0.
|
|
8
|
+
const VERSION = "1.0.42";
|
|
9
9
|
const BASE_URL = `https://github.com/volcengine/volcengine-cli/releases/download/v${VERSION}`;
|
|
10
10
|
|
|
11
11
|
const PLATFORM_MAP = {
|
|
@@ -43,20 +43,28 @@ const binPath = path.join(binDir, binaryName);
|
|
|
43
43
|
function download(url) {
|
|
44
44
|
return new Promise((resolve, reject) => {
|
|
45
45
|
const follow = (url) => {
|
|
46
|
-
https
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
https
|
|
47
|
+
.get(url, (res) => {
|
|
48
|
+
if (
|
|
49
|
+
res.statusCode >= 300 &&
|
|
50
|
+
res.statusCode < 400 &&
|
|
51
|
+
res.headers.location
|
|
52
|
+
) {
|
|
53
|
+
follow(res.headers.location);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (res.statusCode !== 200) {
|
|
57
|
+
reject(
|
|
58
|
+
new Error(`Download failed: HTTP ${res.statusCode} for ${url}`),
|
|
59
|
+
);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const chunks = [];
|
|
63
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
64
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
65
|
+
res.on("error", reject);
|
|
66
|
+
})
|
|
67
|
+
.on("error", reject);
|
|
60
68
|
};
|
|
61
69
|
follow(url);
|
|
62
70
|
});
|
|
@@ -76,7 +84,7 @@ async function install() {
|
|
|
76
84
|
if (isWindows) {
|
|
77
85
|
execSync(
|
|
78
86
|
`powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${tmpDir}' -Force"`,
|
|
79
|
-
{ stdio: "pipe" }
|
|
87
|
+
{ stdio: "pipe" },
|
|
80
88
|
);
|
|
81
89
|
} else {
|
|
82
90
|
execSync(`unzip -o -q "${zipPath}" -d "${tmpDir}"`, { stdio: "pipe" });
|
|
@@ -86,7 +94,10 @@ async function install() {
|
|
|
86
94
|
const veBinary = extracted.find((f) => f === "ve" || f === "ve.exe");
|
|
87
95
|
|
|
88
96
|
if (!veBinary) {
|
|
89
|
-
console.error(
|
|
97
|
+
console.error(
|
|
98
|
+
"Could not find 've' binary in zip archive. Found:",
|
|
99
|
+
extracted,
|
|
100
|
+
);
|
|
90
101
|
process.exit(1);
|
|
91
102
|
}
|
|
92
103
|
|
|
@@ -99,7 +110,9 @@ async function install() {
|
|
|
99
110
|
// macOS: remove quarantine attribute to avoid Gatekeeper blocking
|
|
100
111
|
if (process.platform === "darwin") {
|
|
101
112
|
try {
|
|
102
|
-
execSync(`xattr -d com.apple.quarantine "${binPath}"`, {
|
|
113
|
+
execSync(`xattr -d com.apple.quarantine "${binPath}"`, {
|
|
114
|
+
stdio: "pipe",
|
|
115
|
+
});
|
|
103
116
|
} catch (_) {
|
|
104
117
|
// Attribute may not exist, ignore
|
|
105
118
|
}
|