@sourcemeta/jsonschema 12.8.0 → 12.9.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 → README.markdown} +1 -1
- package/{jsonschema-darwin-arm64 → build/github-releases/jsonschema-darwin-arm64} +0 -0
- package/{jsonschema-darwin-x86_64 → build/github-releases/jsonschema-darwin-x86_64} +0 -0
- package/{jsonschema-linux-arm64 → build/github-releases/jsonschema-linux-arm64} +0 -0
- package/{jsonschema-linux-x86_64 → build/github-releases/jsonschema-linux-x86_64} +0 -0
- package/{jsonschema-windows-x86_64.exe → build/github-releases/jsonschema-windows-x86_64.exe} +0 -0
- package/npm/cli.js +12 -0
- package/npm/main.js +67 -0
- package/package.json +35 -13
- package/cli.js +0 -29
|
@@ -132,7 +132,7 @@ Where `X.Y.Z` is replaced with the desired version. For example:
|
|
|
132
132
|
uses: actions/checkout@v4
|
|
133
133
|
|
|
134
134
|
- name: Install the JSON Schema CLI
|
|
135
|
-
uses: sourcemeta/jsonschema@v12.
|
|
135
|
+
uses: sourcemeta/jsonschema@v12.9.3
|
|
136
136
|
|
|
137
137
|
# Then use as usual
|
|
138
138
|
- run: jsonschema fmt path/to/schemas --check
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/{jsonschema-windows-x86_64.exe → build/github-releases/jsonschema-windows-x86_64.exe}
RENAMED
|
Binary file
|
package/npm/cli.js
ADDED
package/npm/main.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const child_process = require('child_process');
|
|
5
|
+
|
|
6
|
+
const PLATFORM = os.platform() === 'win32' ? 'windows' : os.platform();
|
|
7
|
+
const ARCH = os.arch() === 'x64' ? 'x86_64' : os.arch();
|
|
8
|
+
const EXTENSION = PLATFORM === 'windows' ? '.exe' : '';
|
|
9
|
+
const EXECUTABLE = path.join(__dirname, '..', 'build', 'github-releases',
|
|
10
|
+
`jsonschema-${PLATFORM}-${ARCH}${EXTENSION}`);
|
|
11
|
+
|
|
12
|
+
function spawn(args, options = {}) {
|
|
13
|
+
const json = options.json === true;
|
|
14
|
+
const spawnArgs = json ? [...args, '--json'] : args;
|
|
15
|
+
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
if (!fs.existsSync(EXECUTABLE)) {
|
|
18
|
+
reject(new Error(
|
|
19
|
+
`The JSON Schema CLI NPM package does not support ${os.platform()} for ${os.arch()} yet. ` +
|
|
20
|
+
'Please open a GitHub issue at https://github.com/sourcemeta/jsonschema'
|
|
21
|
+
));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (PLATFORM === 'darwin') {
|
|
26
|
+
child_process.spawnSync('/usr/bin/xattr', ['-c', EXECUTABLE], { stdio: 'inherit' });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const spawnOptions = {
|
|
30
|
+
windowsHide: true,
|
|
31
|
+
...options
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
delete spawnOptions.json;
|
|
35
|
+
|
|
36
|
+
const process = child_process.spawn(EXECUTABLE, spawnArgs, spawnOptions);
|
|
37
|
+
|
|
38
|
+
let stdout = '';
|
|
39
|
+
let stderr = '';
|
|
40
|
+
|
|
41
|
+
if (process.stdout) {
|
|
42
|
+
process.stdout.on('data', (data) => {
|
|
43
|
+
stdout += data.toString();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (process.stderr) {
|
|
48
|
+
process.stderr.on('data', (data) => {
|
|
49
|
+
stderr += data.toString();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
process.on('error', (error) => {
|
|
54
|
+
reject(error);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
process.on('close', (code) => {
|
|
58
|
+
resolve({
|
|
59
|
+
code: code,
|
|
60
|
+
stdout: json ? JSON.parse(stdout) : stdout,
|
|
61
|
+
stderr: stderr
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = { spawn };
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sourcemeta/jsonschema",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.9.3",
|
|
4
4
|
"description": "The CLI for working with JSON Schema. Covers formatting, linting, testing, and much more for both local development and CI/CD pipelines",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"main": "npm/main.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./npm/main.js",
|
|
8
|
+
"./package.json": "./package.json"
|
|
8
9
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
10
|
+
"bin": {
|
|
11
|
+
"jsonschema": "npm/cli.js"
|
|
11
12
|
},
|
|
12
13
|
"license": "AGPL-3.0",
|
|
13
14
|
"homepage": "https://github.com/sourcemeta/jsonschema",
|
|
@@ -16,18 +17,38 @@
|
|
|
16
17
|
"name": "Sourcemeta",
|
|
17
18
|
"url": "https://www.sourcemeta.com"
|
|
18
19
|
},
|
|
19
|
-
"os": [
|
|
20
|
-
|
|
20
|
+
"os": [
|
|
21
|
+
"darwin",
|
|
22
|
+
"linux",
|
|
23
|
+
"win32"
|
|
24
|
+
],
|
|
25
|
+
"cpu": [
|
|
26
|
+
"x64",
|
|
27
|
+
"arm64"
|
|
28
|
+
],
|
|
21
29
|
"engines": {
|
|
22
30
|
"node": ">=16"
|
|
23
31
|
},
|
|
24
32
|
"funding": "https://github.com/sponsors/sourcemeta",
|
|
25
33
|
"keywords": [
|
|
26
|
-
"jsonschema",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"json-schema
|
|
30
|
-
"
|
|
34
|
+
"jsonschema",
|
|
35
|
+
"json",
|
|
36
|
+
"schema",
|
|
37
|
+
"json-schema",
|
|
38
|
+
"cli",
|
|
39
|
+
"$ref",
|
|
40
|
+
"dereference",
|
|
41
|
+
"reference",
|
|
42
|
+
"resolve",
|
|
43
|
+
"json-pointer",
|
|
44
|
+
"validator",
|
|
45
|
+
"validation",
|
|
46
|
+
"bundle",
|
|
47
|
+
"json-schema-validator",
|
|
48
|
+
"json-schema-validation",
|
|
49
|
+
"lint",
|
|
50
|
+
"format",
|
|
51
|
+
"draft"
|
|
31
52
|
],
|
|
32
53
|
"bugs": {
|
|
33
54
|
"url": "https://github.com/sourcemeta/jsonschema/issues"
|
|
@@ -37,6 +58,7 @@
|
|
|
37
58
|
"url": "git+https://github.com/sourcemeta/jsonschema.git"
|
|
38
59
|
},
|
|
39
60
|
"publishConfig": {
|
|
61
|
+
"provenance": true,
|
|
40
62
|
"access": "public"
|
|
41
63
|
},
|
|
42
64
|
"devDependencies": {
|
package/cli.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const os = require('os');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const child_process = require('child_process');
|
|
6
|
-
|
|
7
|
-
const PLATFORM = os.platform() === 'win32' ? 'windows' : os.platform();
|
|
8
|
-
const ARCH = os.arch() === 'x64' ? 'x86_64' : os.arch();
|
|
9
|
-
const EXECUTABLE = PLATFORM === 'windows'
|
|
10
|
-
? path.join(__dirname, `jsonschema-${PLATFORM}-${ARCH}.exe`)
|
|
11
|
-
: path.join(__dirname, `jsonschema-${PLATFORM}-${ARCH}`);
|
|
12
|
-
|
|
13
|
-
if (!fs.existsSync(EXECUTABLE)) {
|
|
14
|
-
console.error(`The JSON Schema CLI NPM package does not support ${os.platform()} for ${ARCH} yet`);
|
|
15
|
-
console.error('Please open a GitHub issue at https://github.com/sourcemeta/jsonschema');
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (PLATFORM === 'darwin') {
|
|
20
|
-
child_process.spawnSync('/usr/bin/xattr', [ '-c', EXECUTABLE ], { stdio: 'inherit' });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const result = child_process.spawnSync(EXECUTABLE, process.argv.slice(2), {
|
|
24
|
-
stdio: 'inherit',
|
|
25
|
-
// Do not open a command prompt on spawning
|
|
26
|
-
windowsHide: true
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
process.exit(result.status);
|