@akiojin/gwt 9.0.1 → 9.0.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/package.json +1 -1
- package/scripts/postinstall.js +13 -21
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -11,27 +11,18 @@ const BIN_DIR = path.join(__dirname, "..", "bin");
|
|
|
11
11
|
const BINARY_NAME = os.platform() === "win32" ? "gwt-tui.exe" : "gwt-tui";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Detect the GitHub Release
|
|
14
|
+
* Detect the GitHub Release asset name for the current platform/arch.
|
|
15
|
+
* Matches the naming convention: gwt-{os}-{arch}[.exe]
|
|
15
16
|
*/
|
|
16
|
-
function
|
|
17
|
+
function releaseAssetName() {
|
|
17
18
|
const platform = os.platform();
|
|
18
19
|
const arch = os.arch();
|
|
19
20
|
|
|
20
|
-
if (platform === "darwin" && arch === "arm64")
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (platform === "
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
if (platform === "linux" && arch === "x64") {
|
|
27
|
-
return "gwt-tui-linux-x86_64";
|
|
28
|
-
}
|
|
29
|
-
if (platform === "linux" && arch === "arm64") {
|
|
30
|
-
return "gwt-tui-linux-aarch64";
|
|
31
|
-
}
|
|
32
|
-
if (platform === "win32" && arch === "x64") {
|
|
33
|
-
return "gwt-tui-windows-x86_64";
|
|
34
|
-
}
|
|
21
|
+
if (platform === "darwin" && arch === "arm64") return "gwt-macos-aarch64";
|
|
22
|
+
if (platform === "darwin" && arch === "x64") return "gwt-macos-x86_64";
|
|
23
|
+
if (platform === "linux" && arch === "x64") return "gwt-linux-x86_64";
|
|
24
|
+
if (platform === "linux" && arch === "arm64") return "gwt-linux-aarch64";
|
|
25
|
+
if (platform === "win32" && arch === "x64") return "gwt-windows-x86_64.exe";
|
|
35
26
|
|
|
36
27
|
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
37
28
|
}
|
|
@@ -87,22 +78,23 @@ async function main() {
|
|
|
87
78
|
}
|
|
88
79
|
|
|
89
80
|
const version = readVersion();
|
|
90
|
-
const
|
|
81
|
+
const asset = releaseAssetName();
|
|
91
82
|
const tag = `v${version}`;
|
|
92
|
-
const binaryUrl = `https://github.com/${REPO}/releases/download/${tag}/${
|
|
83
|
+
const binaryUrl = `https://github.com/${REPO}/releases/download/${tag}/${asset}`;
|
|
93
84
|
|
|
94
85
|
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
95
86
|
|
|
96
87
|
const dest = path.join(BIN_DIR, BINARY_NAME);
|
|
97
88
|
|
|
98
|
-
console.log(`gwt
|
|
89
|
+
console.log(`Downloading gwt binary for ${os.platform()}-${os.arch()}...`);
|
|
90
|
+
console.log(`Downloading from: ${binaryUrl}`);
|
|
99
91
|
|
|
100
92
|
try {
|
|
101
93
|
await download(binaryUrl, dest);
|
|
102
94
|
if (os.platform() !== "win32") {
|
|
103
95
|
fs.chmodSync(dest, 0o755);
|
|
104
96
|
}
|
|
105
|
-
console.log(`gwt
|
|
97
|
+
console.log(`gwt binary installed successfully!`);
|
|
106
98
|
} catch (err) {
|
|
107
99
|
console.error(`gwt: failed to download binary - ${err.message}`);
|
|
108
100
|
console.error("gwt: you can build from source with: cargo build --release -p gwt-tui");
|