@seyuna/cli 0.0.2-dev.0 → 0.0.2-dev.10
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/node-install.js +1 -7
- package/package.json +2 -2
- package/bin/seyuna +0 -0
- package/deno-install.ts +0 -62
- package/deno-wrapper.ts +0 -42
- package/deno.json +0 -13
package/node-install.js
CHANGED
|
@@ -6,6 +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.10";
|
|
9
10
|
|
|
10
11
|
async function downloadFile(url, dest) {
|
|
11
12
|
const res = await fetch(url);
|
|
@@ -26,14 +27,7 @@ async function downloadFile(url, dest) {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
async function getVersion() {
|
|
30
|
-
const pkgPath = path.join(__dirname, "package.json");
|
|
31
|
-
const pkgJson = await readFile(pkgPath, "utf8");
|
|
32
|
-
return JSON.parse(pkgJson).version;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
30
|
async function main() {
|
|
36
|
-
const version = await getVersion();
|
|
37
31
|
|
|
38
32
|
const platform = process.platform;
|
|
39
33
|
let target;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seyuna/cli",
|
|
3
|
-
"version": "0.0.2-dev.
|
|
3
|
+
"version": "0.0.2-dev.10",
|
|
4
4
|
"bin": {
|
|
5
5
|
"seyuna": "./bin/seyuna"
|
|
6
6
|
},
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"postinstall": "node node-install.js"
|
|
9
9
|
},
|
|
10
10
|
"description": "Seyuna CLI",
|
|
11
11
|
"author": "Seyuna",
|
package/bin/seyuna
DELETED
|
Binary file
|
package/deno-install.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// deno-install.ts
|
|
2
|
-
import { join, dirname } from "jsr:@std/path@^0.224.0";
|
|
3
|
-
import { ensureDir } from "jsr:@std/fs@^0.224.0";
|
|
4
|
-
|
|
5
|
-
async function getVersion(): Promise<string> {
|
|
6
|
-
const text = await Deno.readTextFile("deno.json");
|
|
7
|
-
const config = JSON.parse(text);
|
|
8
|
-
return config.version;
|
|
9
|
-
}
|
|
10
|
-
|
|
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);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function main() {
|
|
23
|
-
const version = await getVersion();
|
|
24
|
-
const platform = Deno.build.os;
|
|
25
|
-
|
|
26
|
-
let target: string;
|
|
27
|
-
let output: string;
|
|
28
|
-
|
|
29
|
-
switch (platform) {
|
|
30
|
-
case "windows":
|
|
31
|
-
target = "seyuna-windows.exe";
|
|
32
|
-
output = "seyuna.exe";
|
|
33
|
-
break;
|
|
34
|
-
case "darwin":
|
|
35
|
-
target = "seyuna-macos";
|
|
36
|
-
output = "seyuna";
|
|
37
|
-
break;
|
|
38
|
-
case "linux":
|
|
39
|
-
target = "seyuna-linux";
|
|
40
|
-
output = "seyuna";
|
|
41
|
-
break;
|
|
42
|
-
default:
|
|
43
|
-
console.error(`Unsupported platform: ${platform}`);
|
|
44
|
-
Deno.exit(1);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const destPath = join("bin", output);
|
|
48
|
-
const releaseUrl = `https://github.com/seyuna-corp/seyuna-cli/releases/download/v${version}/${target}`;
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
await downloadFile(releaseUrl, destPath);
|
|
52
|
-
if (platform !== "windows") {
|
|
53
|
-
await Deno.chmod(destPath, 0o755);
|
|
54
|
-
}
|
|
55
|
-
console.log(`seyuna CLI v${version} installed to ${destPath}`);
|
|
56
|
-
} catch (err) {
|
|
57
|
-
console.error("Installation failed:", err);
|
|
58
|
-
Deno.exit(1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
await main();
|
package/deno-wrapper.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S deno run --allow-run --allow-read --allow-write --allow-net
|
|
2
|
-
|
|
3
|
-
import { join } from "jsr:@std/path@1";
|
|
4
|
-
import { existsSync } from "jsr:@std/fs@1";
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
const platform = Deno.build.os; // "windows", "linux", or "darwin"
|
|
8
|
-
const binName = platform === "windows" ? "seyuna.exe" : "seyuna";
|
|
9
|
-
const binPath = join(Deno.cwd(), "bin", binName);
|
|
10
|
-
|
|
11
|
-
// If binary does not exist, run deno-install.ts to download it
|
|
12
|
-
if (!existsSync(binPath)) {
|
|
13
|
-
console.log("seyuna binary not found, running deno-install.ts to download it...");
|
|
14
|
-
const installProcess = Deno.run({
|
|
15
|
-
cmd: ["deno", "run", "--allow-write", "--allow-net", "deno-install.ts"],
|
|
16
|
-
stdin: "inherit",
|
|
17
|
-
stdout: "inherit",
|
|
18
|
-
stderr: "inherit",
|
|
19
|
-
});
|
|
20
|
-
const installStatus = await installProcess.status();
|
|
21
|
-
installProcess.close();
|
|
22
|
-
if (!installStatus.success) {
|
|
23
|
-
console.error("Failed to run deno-install.ts");
|
|
24
|
-
Deno.exit(installStatus.code);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Now run the seyuna binary with passed arguments
|
|
29
|
-
const cmd = [binPath, ...Deno.args];
|
|
30
|
-
const process = Deno.run({
|
|
31
|
-
cmd,
|
|
32
|
-
stdin: "inherit",
|
|
33
|
-
stdout: "inherit",
|
|
34
|
-
stderr: "inherit",
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const status = await process.status();
|
|
38
|
-
process.close();
|
|
39
|
-
Deno.exit(status.code);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
main();
|
package/deno.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@seyuna/cli",
|
|
3
|
-
"version": "0.0.2-dev.0",
|
|
4
|
-
"description": "Seyuna CLI",
|
|
5
|
-
"bin": {
|
|
6
|
-
"seyuna": "./deno-wrapper.ts"
|
|
7
|
-
},
|
|
8
|
-
"exports": "./deno-wrapper.ts",
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"tasks": {
|
|
11
|
-
"install": "deno run --allow-write --allow-net deno-install.ts"
|
|
12
|
-
}
|
|
13
|
-
}
|