zelosh 0.0.1

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 ADDED
@@ -0,0 +1,49 @@
1
+ # zelosh
2
+
3
+ `zelosh` is a publish-only wrapper package that exposes two CLI entrypoints:
4
+
5
+ - `zelo`
6
+ - `zelo-server`
7
+
8
+ At runtime it selects a prebuilt native binary by platform/arch and executes it.
9
+
10
+ The binaries are shipped via platform-specific optional dependencies:
11
+
12
+ - `@zelo/zelosh-darwin-arm64`
13
+ - `@zelo/zelosh-darwin-x64`
14
+ - `@zelo/zelosh-linux-arm64`
15
+ - `@zelo/zelosh-linux-x64`
16
+ - `@zelo/zelosh-win32-arm64`
17
+ - `@zelo/zelosh-win32-x64`
18
+
19
+ At runtime it resolves `@zelo/zelosh-${process.platform}-${process.arch}` and executes the binary from that package.
20
+
21
+ ## Platform package layout
22
+
23
+ Inside each `@zelo/zelosh-<platform>-<arch>` package:
24
+
25
+ ```
26
+ bin/
27
+ zelo[.exe]
28
+ zelo-server[.exe]
29
+ ```
30
+
31
+ ## Release (CI-friendly)
32
+
33
+ Bun can't cross-compile `--compile` binaries, so build each platform/arch in a matrix, then assemble and publish in a final job.
34
+
35
+ Build (per platform job):
36
+
37
+ ```bash
38
+ bun run scripts/release-zelosh.ts pack
39
+ ```
40
+
41
+ This produces an npm tarball under `dist/` like:
42
+
43
+ - `dist/zelo-zelosh-<platform>-<arch>-<version>.tgz`
44
+
45
+ Publish (final job):
46
+
47
+ ```bash
48
+ bun run scripts/release-zelosh.ts release --artifacts dist -- --access public
49
+ ```
package/bin/_runner.js ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawn } = require("node:child_process");
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+
8
+ function resolveBinaryPath(binBaseName) {
9
+ const platform = process.platform;
10
+ const arch = process.arch;
11
+ const exe = platform === "win32" ? ".exe" : "";
12
+
13
+ const target = `${platform}-${arch}`;
14
+ const platformPackageName = `@zelo/zelosh-${target}`;
15
+
16
+ let platformPackageRoot = null;
17
+ try {
18
+ const pkgJsonPath = require.resolve(`${platformPackageName}/package.json`);
19
+ platformPackageRoot = path.dirname(pkgJsonPath);
20
+ } catch {
21
+ // ignore
22
+ }
23
+
24
+ const binPath = platformPackageRoot ? path.join(platformPackageRoot, "bin", `${binBaseName}${exe}`) : "";
25
+
26
+ return { binPath, target, platformPackageName, platformPackageRoot };
27
+ }
28
+
29
+ function ensureUnixExecutable(binPath) {
30
+ if (process.platform === "win32") return;
31
+ try {
32
+ fs.accessSync(binPath, fs.constants.X_OK);
33
+ } catch {
34
+ try {
35
+ fs.chmodSync(binPath, 0o755);
36
+ } catch {
37
+ // ignore
38
+ }
39
+ }
40
+ }
41
+
42
+ function printMissingBinaryHelp(binBaseName, target, platformPackageName, binPath, platformPackageRoot) {
43
+ const exe = process.platform === "win32" ? ".exe" : "";
44
+ const expectedBinaryPath = binPath || `<node_modules>/${platformPackageName}/bin/${binBaseName}${exe}`;
45
+ // eslint-disable-next-line no-console
46
+ console.error(
47
+ [
48
+ `zelosh: missing binary for ${target}.`,
49
+ `Expected package: ${platformPackageName}`,
50
+ `Expected binary: ${expectedBinaryPath}`,
51
+ "",
52
+ platformPackageRoot ? "The platform package is installed, but the binary is missing/corrupted." : "The platform package is not installed (optionalDependencies may have been skipped).",
53
+ "",
54
+ "Try reinstalling without --no-optional, or install the platform package manually.",
55
+ ].join("\n"),
56
+ );
57
+ }
58
+
59
+ function run(binBaseName) {
60
+ const { binPath, target, platformPackageName, platformPackageRoot } = resolveBinaryPath(binBaseName);
61
+ if (!fs.existsSync(binPath)) {
62
+ printMissingBinaryHelp(binBaseName, target, platformPackageName, binPath, platformPackageRoot);
63
+ process.exitCode = 1;
64
+ return;
65
+ }
66
+
67
+ ensureUnixExecutable(binPath);
68
+
69
+ const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit", windowsHide: true });
70
+
71
+ child.on("error", (err) => {
72
+ // eslint-disable-next-line no-console
73
+ console.error(`zelosh: failed to start ${binBaseName}:`, err);
74
+ process.exitCode = 1;
75
+ });
76
+
77
+ child.on("exit", (code, signal) => {
78
+ if (typeof code === "number") {
79
+ process.exit(code);
80
+ return;
81
+ }
82
+ // Best-effort: mirror signal behavior when possible.
83
+ if (signal) {
84
+ try {
85
+ process.kill(process.pid, signal);
86
+ return;
87
+ } catch {
88
+ // ignore
89
+ }
90
+ }
91
+ process.exit(1);
92
+ });
93
+ }
94
+
95
+ module.exports = { run };
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { run } = require("./_runner");
5
+
6
+ run("zelo-server");
7
+
package/bin/zelo.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { run } = require("./_runner");
5
+
6
+ run("zelo");
7
+
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "zelosh",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "type": "commonjs",
6
+ "description": "Zelo published binaries wrapper (zelo, zelo-server).",
7
+ "bin": {
8
+ "zelo": "./bin/zelo.js",
9
+ "zelo-server": "./bin/zelo-server.js"
10
+ },
11
+ "optionalDependencies": {
12
+ "@zelo/zelosh-darwin-arm64": "0.0.1",
13
+ "@zelo/zelosh-darwin-x64": "0.0.1",
14
+ "@zelo/zelosh-linux-arm64": "0.0.1",
15
+ "@zelo/zelosh-linux-x64": "0.0.1",
16
+ "@zelo/zelosh-win32-arm64": "0.0.1",
17
+ "@zelo/zelosh-win32-x64": "0.0.1"
18
+ },
19
+ "files": [
20
+ "bin/",
21
+ "README.md"
22
+ ]
23
+ }