@seyuna/cli 0.0.2-dev.17 → 0.0.2-dev.18
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.js +6 -28
- package/install.js +42 -0
- package/package.json +5 -5
package/bin/seyuna.js
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
const { spawn } = require("child_process");
|
|
3
3
|
const path = require("path");
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
// Lookup table for all platforms and binary distribution packages
|
|
7
|
-
const BINARY_DISTRIBUTION_PACKAGES = {
|
|
8
|
-
darwin: "@seyuna/cli-darwin",
|
|
9
|
-
linux: "@seyuna/cli-linux",
|
|
10
|
-
freebsd: "@seyuna/cli-linux",
|
|
11
|
-
win32: "@seyuna/cli-win32",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Windows binaries end with .exe so we need to special case them.
|
|
15
|
-
const binaryName = process.platform === "win32" ? "seyuna.exe" : "seyuna";
|
|
16
|
-
|
|
17
|
-
// Determine package name for this platform
|
|
18
|
-
const platformSpecificPackageName =
|
|
19
|
-
BINARY_DISTRIBUTION_PACKAGES[process.platform];
|
|
4
|
+
const os = require("os");
|
|
20
5
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Resolving will fail if the optionalDependency was not installed
|
|
24
|
-
return require.resolve(`${platformSpecificPackageName}/bin/${binaryName}`);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
return path.join(__dirname, "..", binaryName);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
6
|
+
const exe = os.platform() === "win32" ? "seyuna.exe" : "seyuna";
|
|
7
|
+
const binPath = path.join(__dirname, exe);
|
|
29
8
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
9
|
+
const proc = spawn(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
10
|
+
proc.on("exit", code => process.exit(code));
|
package/install.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const os = require("os");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
|
|
5
|
+
const platform = os.platform();
|
|
6
|
+
let pkg;
|
|
7
|
+
|
|
8
|
+
switch (platform) {
|
|
9
|
+
case "darwin":
|
|
10
|
+
pkg = "@seyuna/cli-darwin";
|
|
11
|
+
break;
|
|
12
|
+
case "linux":
|
|
13
|
+
pkg = "@seyuna/cli-linux";
|
|
14
|
+
break;
|
|
15
|
+
case "win32":
|
|
16
|
+
pkg = "@seyuna/cli-win32";
|
|
17
|
+
break;
|
|
18
|
+
default:
|
|
19
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const binSrc = require.resolve(`${pkg}/bin/seyuna${platform === "win32" ? ".exe" : ""}`);
|
|
25
|
+
const binDest = path.join(__dirname, "bin", `seyuna${platform === "win32" ? ".exe" : ""}`);
|
|
26
|
+
|
|
27
|
+
fs.mkdirSync(path.dirname(binDest), { recursive: true });
|
|
28
|
+
fs.copyFileSync(binSrc, binDest);
|
|
29
|
+
|
|
30
|
+
if (platform !== "win32") {
|
|
31
|
+
fs.chmodSync(binDest, 0o755);
|
|
32
|
+
} else {
|
|
33
|
+
// Create Windows CMD shim
|
|
34
|
+
const cmdShimPath = path.join(__dirname, "bin", "seyuna.cmd");
|
|
35
|
+
fs.writeFileSync(cmdShimPath, `@echo off\r\n"${binDest}" %*`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
console.log(`seyuna installed for ${platform}`);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error(`Failed to install seyuna for ${platform}:`, err);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seyuna/cli",
|
|
3
|
-
"version": "0.0.2-dev.
|
|
3
|
+
"version": "0.0.2-dev.18",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"bin": {
|
|
6
|
-
"seyuna": "./bin/seyuna"
|
|
6
|
+
"seyuna": "./bin/seyuna.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"postinstall": "node ./install.js"
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"node": ">=18"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@seyuna/cli-darwin": "0.0.2-dev.
|
|
19
|
-
"@seyuna/cli-linux": "0.0.2-dev.
|
|
20
|
-
"@seyuna/cli-win32": "0.0.2-dev.
|
|
18
|
+
"@seyuna/cli-darwin": "0.0.2-dev.18",
|
|
19
|
+
"@seyuna/cli-linux": "0.0.2-dev.18",
|
|
20
|
+
"@seyuna/cli-win32": "0.0.2-dev.18"
|
|
21
21
|
}
|
|
22
22
|
}
|