squawk-cli 1.1.0 → 1.1.2
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/js/install.js +8 -10
- package/package.json +1 -1
package/js/install.js
CHANGED
|
@@ -46,19 +46,17 @@ const { binaryPath } = require("./helpers")
|
|
|
46
46
|
// e.g.: https://github.com/sbdchd/squawk/releases/download/v0.1.3/squawk-darwin-x86_64
|
|
47
47
|
const RELEASES_BASE_URL = "https://github.com/sbdchd/squawk/releases/download"
|
|
48
48
|
|
|
49
|
+
const SUPPORTED_PLATFORMS = new Set(["darwin-x64", "darwin-arm64", "linux-x64"])
|
|
50
|
+
|
|
49
51
|
/**
|
|
50
52
|
* @param {string} platform
|
|
53
|
+
* @param {string} arch
|
|
51
54
|
*/
|
|
52
|
-
function getDownloadUrl(platform) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case "darwin":
|
|
56
|
-
return `${releasesUrl}-darwin-x86_64`
|
|
57
|
-
case "linux":
|
|
58
|
-
return `${releasesUrl}-linux-x86_64`
|
|
59
|
-
default:
|
|
60
|
-
return null
|
|
55
|
+
function getDownloadUrl(platform, arch) {
|
|
56
|
+
if (!SUPPORTED_PLATFORMS.has(`${platform}-${arch}`)) {
|
|
57
|
+
return null
|
|
61
58
|
}
|
|
59
|
+
return `${RELEASES_BASE_URL}/v${pkgInfo.version}/squawk-${platform}-${arch}`
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
function getNpmCache() {
|
|
@@ -107,7 +105,7 @@ function getDecompressor(response) {
|
|
|
107
105
|
function downloadBinary() {
|
|
108
106
|
const arch = os.arch()
|
|
109
107
|
const platform = os.platform()
|
|
110
|
-
const downloadUrl = getDownloadUrl(platform)
|
|
108
|
+
const downloadUrl = getDownloadUrl(platform, arch)
|
|
111
109
|
if (!downloadUrl) {
|
|
112
110
|
return Promise.reject(new Error(`unsupported target ${platform}-${arch}`))
|
|
113
111
|
}
|