@pi-sloane/cli 0.6.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 +5 -0
- package/bin/sloane.cjs +45 -0
- package/package.json +24 -0
package/README.md
ADDED
package/bin/sloane.cjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("node:child_process");
|
|
3
|
+
|
|
4
|
+
const platformPackages = {
|
|
5
|
+
"darwin-arm64": "@pi-sloane/cli-darwin-arm64",
|
|
6
|
+
"darwin-x64": "@pi-sloane/cli-darwin-x64",
|
|
7
|
+
"linux-arm64": "@pi-sloane/cli-linux-arm64",
|
|
8
|
+
"linux-x64": "@pi-sloane/cli-linux-x64",
|
|
9
|
+
"win32-arm64": "@pi-sloane/cli-windows-arm64",
|
|
10
|
+
"win32-x64": "@pi-sloane/cli-windows-x64",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const platformKey = process.platform + "-" + process.arch;
|
|
14
|
+
const packageName = platformPackages[platformKey];
|
|
15
|
+
|
|
16
|
+
if (packageName === undefined) {
|
|
17
|
+
console.error("sloane does not provide a prebuilt binary for " + process.platform + "/" + process.arch + ".");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const executableName = process.platform === "win32" ? "sloane.exe" : "sloane";
|
|
22
|
+
let executablePath;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
executablePath = require.resolve(packageName + "/bin/" + executableName);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error("The optional platform package " + packageName + " is not installed.");
|
|
28
|
+
console.error("Reinstall @pi-sloane/cli with optional dependencies enabled.");
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const result = spawnSync(executablePath, process.argv.slice(2), {
|
|
33
|
+
stdio: "inherit",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (result.error !== undefined) {
|
|
37
|
+
console.error(result.error.message);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (result.signal !== null) {
|
|
42
|
+
process.kill(process.pid, result.signal);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-sloane/cli",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Sloane CLI launcher",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"bin": {
|
|
7
|
+
"sloane": "bin/sloane.cjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@pi-sloane/cli-darwin-arm64": "0.6.0",
|
|
15
|
+
"@pi-sloane/cli-darwin-x64": "0.6.0",
|
|
16
|
+
"@pi-sloane/cli-linux-arm64": "0.6.0",
|
|
17
|
+
"@pi-sloane/cli-linux-x64": "0.6.0",
|
|
18
|
+
"@pi-sloane/cli-windows-arm64": "0.6.0",
|
|
19
|
+
"@pi-sloane/cli-windows-x64": "0.6.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
}
|
|
24
|
+
}
|