zeabur 0.5.4 → 0.5.6

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/README.md CHANGED
@@ -14,7 +14,11 @@
14
14
 
15
15
  ## Quick Start
16
16
 
17
- ### 1. Login
17
+ ### 1. Install
18
+
19
+ No need to install, you can use it directly with npx. Make sure you have Node.js installed.
20
+
21
+ ### 2. Login
18
22
 
19
23
  If you can open the browser:
20
24
 
package/index.js CHANGED
@@ -1,33 +1,44 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execSync } = require('child_process');
4
- const os = require('os');
5
- const {join} = require("path");
6
-
7
- let arch = os.arch();
8
- if(arch === 'x64') {
9
- arch = 'amd64_v1';
3
+ import { execSync } from "child_process";
4
+ import os from "os";
5
+ import { fileURLToPath } from "url";
6
+
7
+ function getPlatform() {
8
+ const platform = os.platform();
9
+
10
+ switch (platform) {
11
+ case "win32":
12
+ return "windows";
13
+ case "darwin":
14
+ case "linux":
15
+ return platform;
16
+ default:
17
+ console.error(`Unsupported platform: ${platform}`);
18
+ process.exit(1);
19
+ }
10
20
  }
11
21
 
12
- const availableArch = ['amd64_v1', 'arm64'];
13
-
14
- if(!availableArch.includes(arch)) {
15
- console.error(`Unsupported architecture: ${arch}`);
16
- process.exit(1);
22
+ function getArch() {
23
+ let arch = os.arch();
24
+
25
+ switch (arch) {
26
+ case 'arm64':
27
+ return 'arm64_v8.0';
28
+ case 'x64':
29
+ return 'amd64_v1';
30
+ default:
31
+ console.error(`Unsupported architecture: ${arch}`);
32
+ process.exit(1);
33
+ }
17
34
  }
18
35
 
19
- let platform = os.platform();
20
- if(platform === 'win32') {
21
- platform = 'windows';
22
- }
23
-
24
- const availablePlatform = ['windows', 'linux', 'darwin'];
25
- if(!availablePlatform.includes(platform)) {
26
- console.error(`Unsupported platform: ${platform}`);
27
- process.exit(1);
28
- }
36
+ (function() {
37
+ const platform = getPlatform();
38
+ const arch = getArch();
29
39
 
30
- const args = process.argv.slice(2);
40
+ const pathToBinary = fileURLToPath(new URL(`./zeabur_${platform}_${arch}/zeabur${platform === "windows" ? ".exe" : ""}`, import.meta.url));
41
+ const args = process.argv.slice(2);
31
42
 
32
- const pathToBinary = join(__dirname,`./zeabur_${platform}_${arch}/zeabur${platform === 'windows' ? '.exe' : ''}`);
33
- execSync(`${pathToBinary} ${args.join(' ')}`, {stdio: 'inherit'});
43
+ execSync(`${pathToBinary} ${args.join(" ")}`, { stdio: "inherit" });
44
+ })()
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "zeabur",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "readme": "README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
+ "type": "module",
8
9
  "bin": {
9
10
  "zeabur": "index.js"
10
11
  }
11
- }
12
+ }
Binary file
index 24e088e..b4917b8 100755
Binary file
Binary file
index ecf78ea..b3a59bc 100755
Binary file
Binary file
index 70a1300..3641400 100755
Binary file