@yuanchuan/aivo 0.19.6 → 0.19.8
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/lib/platform.js +2 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +5 -36
package/lib/platform.js
CHANGED
|
@@ -10,6 +10,7 @@ const PLATFORM_ASSETS = {
|
|
|
10
10
|
x64: "aivo-linux-x64"
|
|
11
11
|
},
|
|
12
12
|
win32: {
|
|
13
|
+
arm64: "aivo-windows-arm64.exe",
|
|
13
14
|
x64: "aivo-windows-x64.exe"
|
|
14
15
|
}
|
|
15
16
|
};
|
|
@@ -21,7 +22,7 @@ function resolvePlatformAsset(platform = process.platform, arch = process.arch)
|
|
|
21
22
|
if (!assetName) {
|
|
22
23
|
throw new Error(
|
|
23
24
|
`Unsupported platform: ${platform}-${arch}. ` +
|
|
24
|
-
"Supported targets: darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-x64."
|
|
25
|
+
"Supported targets: darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-arm64, win32-x64."
|
|
25
26
|
);
|
|
26
27
|
}
|
|
27
28
|
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -30,25 +30,11 @@ async function main(options = {}) {
|
|
|
30
30
|
|
|
31
31
|
let checksumText, binary;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} else {
|
|
39
|
-
const githubBaseUrl = getReleaseBaseUrl(version);
|
|
40
|
-
const mirrorBaseUrl = getMirrorBaseUrl(version);
|
|
41
|
-
[checksumText, binary] = await Promise.all([
|
|
42
|
-
downloadTextWithFallback(
|
|
43
|
-
`${githubBaseUrl}/${assetName}.sha256`,
|
|
44
|
-
`${mirrorBaseUrl}/${assetName}.sha256`
|
|
45
|
-
),
|
|
46
|
-
downloadBufferWithFallback(
|
|
47
|
-
`${githubBaseUrl}/${assetName}`,
|
|
48
|
-
`${mirrorBaseUrl}/${assetName}`
|
|
49
|
-
)
|
|
50
|
-
]);
|
|
51
|
-
}
|
|
33
|
+
const baseUrl = overrideBaseUrl || getReleaseBaseUrl(version);
|
|
34
|
+
[checksumText, binary] = await Promise.all([
|
|
35
|
+
downloadText(`${baseUrl}/${assetName}.sha256`),
|
|
36
|
+
downloadBuffer(`${baseUrl}/${assetName}`)
|
|
37
|
+
]);
|
|
52
38
|
|
|
53
39
|
const expectedSha = parseChecksumText(checksumText, assetName);
|
|
54
40
|
if (!expectedSha) {
|
|
@@ -80,21 +66,7 @@ function downloadText(url) {
|
|
|
80
66
|
return downloadBuffer(url).then((buffer) => buffer.toString("utf8"));
|
|
81
67
|
}
|
|
82
68
|
|
|
83
|
-
function downloadBufferWithFallback(primaryUrl, fallbackUrl) {
|
|
84
|
-
return downloadBuffer(primaryUrl, 0, 10_000).catch(() => {
|
|
85
|
-
return downloadBuffer(fallbackUrl);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function downloadTextWithFallback(primaryUrl, fallbackUrl) {
|
|
90
|
-
return downloadBufferWithFallback(primaryUrl, fallbackUrl).then((buffer) => buffer.toString("utf8"));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
69
|
function getReleaseBaseUrl(version) {
|
|
94
|
-
return `https://github.com/yuanchuan/aivo/releases/download/v${version}`;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function getMirrorBaseUrl(version) {
|
|
98
70
|
return `https://getaivo.dev/dl/v${version}`;
|
|
99
71
|
}
|
|
100
72
|
|
|
@@ -199,11 +171,8 @@ if (require.main === module) {
|
|
|
199
171
|
module.exports = {
|
|
200
172
|
REPAIR_COMMAND,
|
|
201
173
|
downloadBuffer,
|
|
202
|
-
downloadBufferWithFallback,
|
|
203
174
|
downloadText,
|
|
204
|
-
downloadTextWithFallback,
|
|
205
175
|
formatInstallError,
|
|
206
|
-
getMirrorBaseUrl,
|
|
207
176
|
getReleaseBaseUrl,
|
|
208
177
|
installBinary,
|
|
209
178
|
main
|