@xschemadev/cli 0.0.5
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/bin/xschema.js +48 -0
- package/package.json +25 -0
package/bin/xschema.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execFileSync } = require("child_process");
|
|
3
|
+
const { platform, arch } = process;
|
|
4
|
+
|
|
5
|
+
const PLATFORMS = {
|
|
6
|
+
darwin: {
|
|
7
|
+
arm64: "@xschemadev/cli-darwin-arm64",
|
|
8
|
+
x64: "@xschemadev/cli-darwin-x64",
|
|
9
|
+
},
|
|
10
|
+
linux: {
|
|
11
|
+
arm64: "@xschemadev/cli-linux-arm64",
|
|
12
|
+
x64: "@xschemadev/cli-linux-x64",
|
|
13
|
+
},
|
|
14
|
+
win32: {
|
|
15
|
+
arm64: "@xschemadev/cli-win32-arm64",
|
|
16
|
+
x64: "@xschemadev/cli-win32-x64",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const pkg = PLATFORMS[platform]?.[arch];
|
|
21
|
+
if (!pkg) {
|
|
22
|
+
console.error(`xschema: unsupported platform ${platform}-${arch}`);
|
|
23
|
+
console.error("Please open an issue at https://github.com/xschemadev/xschema/issues");
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const bin = platform === "win32" ? "xschema.exe" : "xschema";
|
|
28
|
+
|
|
29
|
+
let binPath;
|
|
30
|
+
try {
|
|
31
|
+
binPath = require.resolve(`${pkg}/${bin}`);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error(`xschema: could not find binary for ${platform}-${arch}`);
|
|
34
|
+
console.error(`Expected package: ${pkg}`);
|
|
35
|
+
console.error("");
|
|
36
|
+
console.error("This usually means npm/bun was run with --ignore-optional.");
|
|
37
|
+
console.error("Try reinstalling: npm install @xschemadev/cli");
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
43
|
+
} catch (e) {
|
|
44
|
+
if (e.status !== undefined) {
|
|
45
|
+
process.exit(e.status);
|
|
46
|
+
}
|
|
47
|
+
throw e;
|
|
48
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xschemadev/cli",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "xschema CLI - JSON Schema to native validators",
|
|
5
|
+
"bin": {
|
|
6
|
+
"xschema": "./bin/xschema.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/xschemadev/xschema.git",
|
|
14
|
+
"directory": "cli"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@xschemadev/cli-darwin-arm64": "0.0.5",
|
|
19
|
+
"@xschemadev/cli-darwin-x64": "0.0.5",
|
|
20
|
+
"@xschemadev/cli-linux-arm64": "0.0.5",
|
|
21
|
+
"@xschemadev/cli-linux-x64": "0.0.5",
|
|
22
|
+
"@xschemadev/cli-win32-arm64": "0.0.5",
|
|
23
|
+
"@xschemadev/cli-win32-x64": "0.0.5"
|
|
24
|
+
}
|
|
25
|
+
}
|