otter-code 0.0.43-nightly.20260924.13
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 +3 -0
- package/bin/t3.js +33 -0
- package/dist/bin.mjs +27 -0
- package/package.json +23 -0
package/README.md
ADDED
package/bin/t3.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const { constants } = require("node:os");
|
|
5
|
+
const { dirname, join } = require("node:path");
|
|
6
|
+
|
|
7
|
+
const SUPPORTED = ["darwin-arm64", "linux-arm64", "linux-x64", "win32-arm64", "win32-x64"];
|
|
8
|
+
const key = process.platform + "-" + process.arch;
|
|
9
|
+
|
|
10
|
+
let packageDir;
|
|
11
|
+
try {
|
|
12
|
+
packageDir = dirname(require.resolve("@otterware/otter-code-" + key + "/package.json"));
|
|
13
|
+
} catch {
|
|
14
|
+
process.stderr.write(
|
|
15
|
+
[
|
|
16
|
+
"otter-code: no Otter Code CLI build is available for this platform (" + key + ").",
|
|
17
|
+
"Supported platforms: " + SUPPORTED.join(", ") + ".",
|
|
18
|
+
"If yours is listed, reinstall otter-code so npm fetches its optional dependency.",
|
|
19
|
+
"The desktop app and release archives are at https://github.com/acme-acme-acme/otter-code/releases",
|
|
20
|
+
"",
|
|
21
|
+
].join("\n"),
|
|
22
|
+
);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const executable = join(packageDir, process.platform === "win32" ? "t3.exe" : "t3");
|
|
27
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: "inherit" });
|
|
28
|
+
if (result.error) {
|
|
29
|
+
process.stderr.write("otter-code: failed to start " + executable + ": " + result.error.message + "\n");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
// A child killed by a signal has no status; report it the way a shell would.
|
|
33
|
+
process.exit(result.status ?? 128 + (constants.signals[result.signal] || 1));
|
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { constants } from "node:os";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const executableName = process.platform === "win32" ? "t3.exe" : "t3";
|
|
7
|
+
const executable = join(dirname(require.resolve("@otterware/otter-code-" + process.platform + "-" + process.arch + "/package.json")), executableName);
|
|
8
|
+
const ipc = process.send !== undefined;
|
|
9
|
+
const child = spawn(executable, process.argv.slice(2), {
|
|
10
|
+
stdio: ipc ? ["inherit", "inherit", "inherit", "ipc"] : "inherit",
|
|
11
|
+
});
|
|
12
|
+
const fail = (error) => {
|
|
13
|
+
if (!error) return;
|
|
14
|
+
process.stderr.write("t3: " + error.message + "\n");
|
|
15
|
+
child.kill("SIGTERM");
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
};
|
|
18
|
+
if (ipc) {
|
|
19
|
+
process.on("message", (message) => { if (child.connected) child.send(message, fail); });
|
|
20
|
+
child.on("message", (message) => { if (process.connected) process.send(message, fail); });
|
|
21
|
+
process.on("disconnect", () => { if (child.connected) child.disconnect(); });
|
|
22
|
+
}
|
|
23
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
24
|
+
process.on(signal, () => child.kill(signal));
|
|
25
|
+
}
|
|
26
|
+
child.on("error", (error) => { fail(error); process.exit(1); });
|
|
27
|
+
child.on("exit", (code, signal) => process.exit(code ?? 128 + (constants.signals[signal] || 1)));
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "otter-code",
|
|
3
|
+
"version": "0.0.43-nightly.20260924.13",
|
|
4
|
+
"description": "Otter Code CLI. Installs the self-contained executable for this platform.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/acme-acme-acme/otter-code",
|
|
9
|
+
"directory": "apps/server"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"otter-code": "./bin/t3.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@otterware/otter-code-darwin-arm64": "0.0.43-nightly.20260924.13",
|
|
20
|
+
"@otterware/otter-code-linux-arm64": "0.0.43-nightly.20260924.13",
|
|
21
|
+
"@otterware/otter-code-linux-x64": "0.0.43-nightly.20260924.13"
|
|
22
|
+
}
|
|
23
|
+
}
|