@onpurposestudio/cli 0.0.1-alpha.0

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,26 @@
1
+ # @onpurposestudio/cli
2
+
3
+ Install the OnPurpose Studio translation CLI:
4
+
5
+ ```sh
6
+ npm install -g @onpurposestudio/cli
7
+ onpurpose --version
8
+ ```
9
+
10
+ Every command other than `--version` or `-V` requires an OnPurpose Studio
11
+ license via `ONPURPOSE_TOKEN` or `ONPURPOSE_LICENSE`. Visit
12
+ [onpurpose.studio](https://onpurpose.studio) to get a license or ask for help.
13
+
14
+ ## Supported platforms
15
+
16
+ | Operating system | Architecture | Supported |
17
+ | --- | --- | --- |
18
+ | macOS | Intel x64 | Yes |
19
+ | macOS | Apple Silicon ARM64 | Yes |
20
+ | Linux with glibc | x64 | Yes |
21
+ | Linux with glibc | ARM64 | Yes |
22
+ | Windows | Any | No |
23
+ | Alpine or other musl Linux | Any | No |
24
+
25
+ The package installs all four supported binaries. Its launcher selects only the
26
+ binary matching the current operating system and architecture.
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawnSync } = require("node:child_process");
5
+ const path = require("node:path");
6
+
7
+ // Select only binaries that are built and supported by this package.
8
+ const binaryNames = {
9
+ "darwin-arm64": "onpurpose-darwin-arm64",
10
+ "darwin-x64": "onpurpose-darwin-x64",
11
+ "linux-arm64": "onpurpose-linux-arm64",
12
+ "linux-x64": "onpurpose-linux-x64",
13
+ };
14
+ const platform = `${process.platform}-${process.arch}`;
15
+ const usesGlibc =
16
+ process.platform !== "linux" ||
17
+ Boolean(process.report?.getReport().header.glibcVersionRuntime);
18
+ const binaryName = usesGlibc ? binaryNames[platform] : undefined;
19
+
20
+ // Reject unsupported systems before attempting to execute another target.
21
+ if (!binaryName) {
22
+ const detail = usesGlibc ? platform : `${platform} with musl`;
23
+ console.error(
24
+ `onpurpose does not support ${detail}. Supported platforms are macOS and glibc Linux on x64 or ARM64.`,
25
+ );
26
+ process.exitCode = 1;
27
+ } else {
28
+ // Share the terminal and preserve the selected binary's exit result.
29
+ const result = spawnSync(
30
+ path.join(__dirname, binaryName),
31
+ process.argv.slice(2),
32
+ { stdio: "inherit" },
33
+ );
34
+
35
+ if (result.error) {
36
+ console.error(`onpurpose could not start: ${result.error.message}`);
37
+ process.exitCode = 1;
38
+ } else if (result.signal) {
39
+ process.kill(process.pid, result.signal);
40
+ } else {
41
+ process.exitCode = result.status;
42
+ }
43
+ }
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@onpurposestudio/cli",
3
+ "version": "0.0.1-alpha.0",
4
+ "description": "OnPurpose Studio translation CLI",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "onpurpose": "bin/onpurpose.js"
8
+ },
9
+ "files": [
10
+ "README.md",
11
+ "bin/onpurpose.js",
12
+ "bin/onpurpose-darwin-arm64",
13
+ "bin/onpurpose-darwin-x64",
14
+ "bin/onpurpose-linux-arm64",
15
+ "bin/onpurpose-linux-x64"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/",
20
+ "tag": "latest"
21
+ }
22
+ }