@seyuna/cli 0.0.2-dev.4 → 0.0.2-dev.5

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.
Binary file
package/deno-wrapper.ts CHANGED
@@ -1,73 +1,41 @@
1
- #!/usr/bin/env -S deno run --allow-run --allow-read --allow-write --allow-net
1
+ import { join } from "https://deno.land/std/path/mod.ts";
2
2
 
3
- import { fromFileUrl, dirname, join } from "jsr:@std/path@^0.224.0";
4
- import { ensureDir, existsSync } from "jsr:@std/fs@^0.224.0";
5
-
6
- const scriptDir = dirname(fromFileUrl(import.meta.url));
7
-
8
- const version = "0.0.2-dev.4";
9
-
10
- // Download a file from a URL to a destination path
11
- async function downloadFile(url: string, dest: string): Promise<void> {
12
- const res = await fetch(url);
13
- if (!res.ok || !res.body) {
14
- throw new Error(`Failed to download ${url}: ${res.status} ${res.statusText}`);
15
- }
16
-
17
- await ensureDir(dirname(dest));
18
- const file = await Deno.open(dest, { create: true, write: true, truncate: true });
19
- await res.body.pipeTo(file.writable);
3
+ function getWritableDir(): string {
4
+ return join(Deno.cwd(), ".seyuna");
20
5
  }
21
6
 
22
- async function main() {
23
- const platform = Deno.build.os; // "windows", "linux", or "darwin"
24
- const binName = platform === "windows" ? "seyuna.exe" : "seyuna";
25
- const binPath = join(scriptDir, "bin", binName);
26
-
27
- if (!existsSync(binPath)) {
28
- console.log("seyuna binary not found, downloading...");
29
-
30
- let target: string;
31
- switch (platform) {
32
- case "windows":
33
- target = "seyuna-windows.exe";
34
- break;
35
- case "darwin":
36
- target = "seyuna-macos";
37
- break;
38
- case "linux":
39
- target = "seyuna-linux";
40
- break;
41
- default:
42
- console.error(`Unsupported platform: ${platform}`);
43
- Deno.exit(1);
44
- }
45
-
46
- const releaseUrl = `https://github.com/seyuna-corp/seyuna-cli/releases/download/v${version}/${target}`;
47
-
48
- try {
49
- await downloadFile(releaseUrl, binPath);
50
- if (platform !== "windows") {
51
- await Deno.chmod(binPath, 0o755);
52
- }
53
- console.log(`seyuna CLI v${version} installed to ${binPath}`);
54
- } catch (err) {
55
- console.error("Installation failed:", err);
56
- Deno.exit(1);
57
- }
58
- }
59
-
60
- // Forward all arguments to the actual binary
61
- const process = Deno.run({
62
- cmd: [binPath, ...Deno.args],
63
- stdin: "inherit",
64
- stdout: "inherit",
65
- stderr: "inherit",
66
- });
67
-
68
- const status = await process.status();
69
- process.close();
70
- Deno.exit(status.code);
7
+ const platform = Deno.build.os;
8
+ const binaryName = platform === "windows"
9
+ ? "seyuna-windows.exe"
10
+ : platform === "darwin"
11
+ ? "seyuna-macos"
12
+ : "seyuna-linux";
13
+
14
+ const version = "0.0.2-dev.5";
15
+ const url = `https://github.com/seyuna-corp/seyuna-cli/releases/download/v${version}/${binaryName}`;
16
+
17
+ const binDir = getWritableDir();
18
+ await Deno.mkdir(binDir, { recursive: true });
19
+ const binaryPath = join(binDir, binaryName);
20
+
21
+ // Download if missing
22
+ try {
23
+ await Deno.stat(binaryPath);
24
+ } catch {
25
+ console.log(`Downloading ${binaryName} from ${url}`);
26
+ const res = await fetch(url);
27
+ if (!res.ok) throw new Error(`Download failed: ${res.status}`);
28
+ const file = await Deno.open(binaryPath, { create: true, write: true });
29
+ await res.body?.pipeTo(file.writable);
30
+ await Deno.chmod(binaryPath, 0o755); // Required for UNIX
71
31
  }
72
32
 
73
- await main();
33
+ // Execute
34
+ const command = new Deno.Command(binaryPath, {
35
+ args: Deno.args,
36
+ stdin: "inherit",
37
+ stdout: "inherit",
38
+ stderr: "inherit",
39
+ });
40
+ const { code } = await command.output();
41
+ Deno.exit(code);
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seyuna/cli",
3
- "version": "0.0.2-dev.4",
3
+ "version": "0.0.2-dev.5",
4
4
  "description": "Seyuna CLI",
5
5
  "bin": {
6
6
  "seyuna": "./deno-wrapper.ts"
package/node-install.js CHANGED
@@ -6,7 +6,7 @@ import { fileURLToPath } from "url";
6
6
  import process from "process";
7
7
 
8
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
- const version = "0.0.2-dev.4";
9
+ const version = "0.0.2-dev.5";
10
10
 
11
11
  async function downloadFile(url, dest) {
12
12
  const res = await fetch(url);
@@ -28,6 +28,7 @@ async function downloadFile(url, dest) {
28
28
  }
29
29
 
30
30
  async function main() {
31
+
31
32
  const platform = process.platform;
32
33
  let target;
33
34
  if (platform === "win32") {
@@ -42,7 +43,12 @@ async function main() {
42
43
  }
43
44
 
44
45
  const releaseUrl = `https://github.com/seyuna-corp/seyuna-cli/releases/download/v${version}/${target}`;
45
- const dest = path.join(__dirname, "bin", platform === "win32" ? "seyuna.exe" : "seyuna");
46
+ const binaryName = platform === "windows"
47
+ ? "seyuna-windows.exe"
48
+ : platform === "darwin"
49
+ ? "seyuna-macos"
50
+ : "seyuna-linux";
51
+ const dest = path.join(__dirname, "bin", binaryName);
46
52
 
47
53
  try {
48
54
  await downloadFile(releaseUrl, dest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seyuna/cli",
3
- "version": "0.0.2-dev.4",
3
+ "version": "0.0.2-dev.5",
4
4
  "bin": {
5
5
  "seyuna": "./bin/seyuna"
6
6
  },