@bloret-crew/blora-agent 0.1.0-beta.3 → 27.0.0-beta.1

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.
Files changed (2) hide show
  1. package/bin/install.js +15 -6
  2. package/package.json +2 -1
package/bin/install.js CHANGED
@@ -18,11 +18,16 @@ const destination = path.join(installDir, executable);
18
18
  const DOWNLOAD_TIMEOUT_MS = 120_000;
19
19
  const MAX_ATTEMPTS = 4;
20
20
 
21
- function platformAsset() {
22
- const arch = process.arch === "x64" ? "x86_64" : process.arch;
23
- const platform = process.platform === "win32" ? "windows" : process.platform;
24
- const ext = platform === "windows" ? "zip" : "tar.gz";
25
- return `blora-${version}-${platform}-${arch}.${ext}`;
21
+ function platformAsset(platform = process.platform, architecture = process.arch) {
22
+ const arch = architecture === "x64" ? "x86_64" : architecture === "arm64" ? "aarch64" : architecture;
23
+ const platformName = {
24
+ linux: "linux",
25
+ darwin: "macos",
26
+ win32: "windows",
27
+ }[platform];
28
+ if (!platformName) throw new Error(`unsupported platform: ${platform}`);
29
+ const ext = platformName === "windows" ? "zip" : "tar.gz";
30
+ return `blora-${version}-${platformName}-${arch}.${ext}`;
26
31
  }
27
32
 
28
33
  function wait(ms) {
@@ -155,4 +160,8 @@ async function main() {
155
160
  }
156
161
  }
157
162
 
158
- main();
163
+ if (require.main === module) {
164
+ main();
165
+ }
166
+
167
+ module.exports = { platformAsset };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloret-crew/blora-agent",
3
- "version": "0.1.0-beta.3",
3
+ "version": "27.0.0-beta.1",
4
4
  "description": "Blora Agent CLI installer",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -21,6 +21,7 @@
21
21
  "LICENSE"
22
22
  ],
23
23
  "scripts": {
24
+ "test": "node --test test/*.test.js",
24
25
  "postinstall": "node bin/install.js"
25
26
  },
26
27
  "engines": {