@linkdood/mx-cli 0.0.0-stage → 0.1.0-dev.2
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/package.json +13 -4
- package/scripts/run.js +45 -0
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkdood/mx-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-dev.2",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"bin": {
|
|
6
|
+
"mx-cli": "scripts/run.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"scripts/run.js"
|
|
10
|
+
],
|
|
11
|
+
"optionalDependencies": {
|
|
12
|
+
"@linkdood/mx-cli-linux-amd64": "0.1.0-dev.1",
|
|
13
|
+
"@linkdood/mx-cli-windows-amd64": "0.1.0-dev.2"
|
|
14
|
+
}
|
|
15
|
+
}
|
package/scripts/run.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
|
|
5
|
+
const platformMap = { linux: "linux", darwin: "darwin", win32: "windows" };
|
|
6
|
+
const archMap = { x64: "amd64", arm64: "arm64" };
|
|
7
|
+
|
|
8
|
+
const platform = platformMap[process.platform];
|
|
9
|
+
const arch = archMap[process.arch];
|
|
10
|
+
|
|
11
|
+
if (!platform || !arch) {
|
|
12
|
+
process.stderr.write(`Unsupported platform: ${process.platform}-${process.arch}\n`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const pkg = `@linkdood/mx-cli-${platform}-${arch}`;
|
|
17
|
+
|
|
18
|
+
let pkgRoot;
|
|
19
|
+
try {
|
|
20
|
+
pkgRoot = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
21
|
+
} catch (_) {
|
|
22
|
+
process.stderr.write(`Missing platform package: ${pkg}\n`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
27
|
+
const candidates = [
|
|
28
|
+
path.join(pkgRoot, "bin", "mx-cli" + ext),
|
|
29
|
+
path.join(pkgRoot, "bin", "cli" + ext),
|
|
30
|
+
];
|
|
31
|
+
const bin = candidates[0];
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
try {
|
|
35
|
+
execFileSync(candidates[0], process.argv.slice(2), { stdio: "inherit" });
|
|
36
|
+
} catch (e) {
|
|
37
|
+
if (candidates.length > 1) {
|
|
38
|
+
execFileSync(candidates[1], process.argv.slice(2), { stdio: "inherit" });
|
|
39
|
+
} else {
|
|
40
|
+
throw e;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
process.exit(e.status || 1);
|
|
45
|
+
}
|
package/README.md
DELETED