@runta/runta-cli 0.1.3
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 +13 -0
- package/bin/runta.js +56 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# runta
|
|
2
|
+
|
|
3
|
+
Runta command-line interface distributed through npm.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @runta/runta-cli
|
|
7
|
+
runta --help
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
This package currently ships Linux binaries for npm's `x64` CPU name (amd64)
|
|
11
|
+
and `arm64`. The top-level package installs a small Node.js launcher and uses
|
|
12
|
+
npm optional dependencies to select the matching native binary package for the
|
|
13
|
+
current platform.
|
package/bin/runta.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("node:child_process");
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
|
|
7
|
+
const packages = new Map([
|
|
8
|
+
["linux:x64", "runta-linux-x64"],
|
|
9
|
+
["linux:arm64", "runta-linux-arm64"],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const platform = process.env.RUNTA_NPM_PLATFORM || process.platform;
|
|
13
|
+
const arch = process.env.RUNTA_NPM_ARCH || process.arch;
|
|
14
|
+
const packageName = packages.get(`${platform}:${arch}`);
|
|
15
|
+
|
|
16
|
+
function fail(message) {
|
|
17
|
+
console.error(message);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!packageName) {
|
|
22
|
+
fail(
|
|
23
|
+
`runta's npm package currently supports Linux x64 and Linux arm64 only; got ${platform}/${arch}.`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let binary;
|
|
28
|
+
try {
|
|
29
|
+
binary = require.resolve(`${packageName}/bin/runta`);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
fail(
|
|
32
|
+
[
|
|
33
|
+
`The ${packageName} optional dependency is missing.`,
|
|
34
|
+
"Reinstall @runta/runta-cli with optional dependencies enabled, for example:",
|
|
35
|
+
" npm install -g @runta/runta-cli --include=optional",
|
|
36
|
+
`Original error: ${error.message}`,
|
|
37
|
+
].join("\n"),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
fs.accessSync(binary, fs.constants.X_OK);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
fail(`The runta binary is not executable at ${binary}: ${error.message}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const result = childProcess.spawnSync(binary, process.argv.slice(2), {
|
|
48
|
+
stdio: "inherit",
|
|
49
|
+
windowsHide: true,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (result.error) {
|
|
53
|
+
fail(`failed to execute ${path.basename(binary)}: ${result.error.message}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@runta/runta-cli",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Runta command-line interface",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/runta-dev/runta.git",
|
|
9
|
+
"directory": "packing/npm/cli"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/runta-dev/runta#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/runta-dev/runta/issues"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"runta": "bin/runta.js"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"prepack": "test -f bin/runta.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/runta.js",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"os": [
|
|
29
|
+
"linux"
|
|
30
|
+
],
|
|
31
|
+
"cpu": [
|
|
32
|
+
"x64",
|
|
33
|
+
"arm64"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=16"
|
|
37
|
+
},
|
|
38
|
+
"optionalDependencies": {
|
|
39
|
+
"runta-linux-x64": "0.1.3",
|
|
40
|
+
"runta-linux-arm64": "0.1.3"
|
|
41
|
+
}
|
|
42
|
+
}
|