@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.
- package/bin/seyuna-linux +0 -0
- package/deno-wrapper.ts +36 -68
- package/deno.json +1 -1
- package/node-install.js +8 -2
- package/package.json +1 -1
package/bin/seyuna-linux
ADDED
|
Binary file
|
package/deno-wrapper.ts
CHANGED
|
@@ -1,73 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { join } from "https://deno.land/std/path/mod.ts";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
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
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.
|
|
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
|
|
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);
|