@skriptfabrik/json-schema-bundler 0.0.0-dev → 0.2.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/.github/workflows/ci.yml +18 -3
- package/Dockerfile +0 -1
- package/README.md +5 -4
- package/json-schema-bundler-cli.js +12 -5
- package/package.json +1 -1
- package/output.json +0 -5
- package/schema.json +0 -5
- package/schema2.json +0 -3
package/.github/workflows/ci.yml
CHANGED
|
@@ -30,11 +30,23 @@ jobs:
|
|
|
30
30
|
node-version: ${{ env.NODE_VERSION }}
|
|
31
31
|
|
|
32
32
|
- name: Install dependencies
|
|
33
|
-
run:
|
|
33
|
+
run: |-
|
|
34
|
+
npm ci
|
|
35
|
+
|
|
36
|
+
- name: Export short SHA
|
|
37
|
+
run: |-
|
|
38
|
+
echo "GITHUB_SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8)" >> ${GITHUB_ENV}
|
|
34
39
|
|
|
35
|
-
- name:
|
|
40
|
+
- name: Set package version
|
|
41
|
+
if: github.ref_name == 'main'
|
|
42
|
+
run: |-
|
|
43
|
+
PACKAGE_VERSION=$(jq -r .version package.json)
|
|
44
|
+
npm version "${PACKAGE_VERSION%-*}-${GITHUB_SHORT_SHA}" --no-git-tag-version
|
|
45
|
+
|
|
46
|
+
- name: Set package version from Git
|
|
36
47
|
if: github.ref_type == 'tag'
|
|
37
|
-
run:
|
|
48
|
+
run: |-
|
|
49
|
+
npm version from-git --no-git-tag-version
|
|
38
50
|
|
|
39
51
|
- name: Publish package
|
|
40
52
|
uses: JS-DevTools/npm-publish@v1
|
|
@@ -61,7 +73,9 @@ jobs:
|
|
|
61
73
|
with:
|
|
62
74
|
build-args: |-
|
|
63
75
|
BUILDKIT_INLINE_CACHE=${{ env.DOCKER_BUILDKIT_INLINE_CACHE }}
|
|
76
|
+
JSON_SCHEMA_BUNDLER_VERSION=${{ env.GITHUB_SHORT_SHA }}
|
|
64
77
|
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE_NAME }}:latest
|
|
78
|
+
context: .
|
|
65
79
|
platforms: |-
|
|
66
80
|
linux/amd64
|
|
67
81
|
linux/arm64
|
|
@@ -83,6 +97,7 @@ jobs:
|
|
|
83
97
|
BUILDKIT_INLINE_CACHE=${{ env.DOCKER_BUILDKIT_INLINE_CACHE }}
|
|
84
98
|
JSON_SCHEMA_BUNDLER_VERSION=v${{ env.RELEASE_VERSION }}
|
|
85
99
|
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE_NAME }}:latest
|
|
100
|
+
context: .
|
|
86
101
|
platforms: |-
|
|
87
102
|
linux/amd64
|
|
88
103
|
linux/arm64
|
package/Dockerfile
CHANGED
|
@@ -4,7 +4,6 @@ LABEL maintainer="Daniel Schröder <daniel.schroeder@skriptfabrik.com>"
|
|
|
4
4
|
|
|
5
5
|
ARG JSON_SCHEMA_BUNDLER_VERSION=latest
|
|
6
6
|
|
|
7
|
-
ENV JSON_SCHEMA_BUNDLER_VERSION=${JSON_SCHEMA_BUNDLER_VERSION}
|
|
8
7
|
ENV NODE_ENV=production
|
|
9
8
|
|
|
10
9
|
COPY . /opt/json-schema-bundler-${JSON_SCHEMA_BUNDLER_VERSION}
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ json-schema-bundler --help
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
```text
|
|
24
|
-
JSON Schema Bundler
|
|
24
|
+
JSON Schema Bundler
|
|
25
25
|
|
|
26
26
|
Usage:
|
|
27
27
|
json-schema-bundler [options] <input>
|
|
@@ -30,9 +30,10 @@ Arguments:
|
|
|
30
30
|
input The path or URL of the input schema file
|
|
31
31
|
|
|
32
32
|
Options:
|
|
33
|
-
-h, --help
|
|
34
|
-
-p, --pretty
|
|
35
|
-
-s, --silent
|
|
33
|
+
-h, --help Display this help message
|
|
34
|
+
-p, --pretty Pretty print output
|
|
35
|
+
-s, --silent Silent mode
|
|
36
|
+
-v, --version Print version number
|
|
36
37
|
|
|
37
38
|
Examples:
|
|
38
39
|
Bundle all references in schema.json and print output to stdout:
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const $RefParser = require('json-schema-ref-parser');
|
|
4
4
|
const minimist = require('minimist');
|
|
5
5
|
const path = require('path');
|
|
6
|
+
const pkg = require('./package.json');
|
|
6
7
|
|
|
7
8
|
const argv = minimist(process.argv.slice(2), {
|
|
8
9
|
boolean: ['h', 'p', 's'],
|
|
@@ -10,6 +11,7 @@ const argv = minimist(process.argv.slice(2), {
|
|
|
10
11
|
h: 'help',
|
|
11
12
|
p: 'pretty',
|
|
12
13
|
s: 'silent',
|
|
14
|
+
v: 'version',
|
|
13
15
|
},
|
|
14
16
|
});
|
|
15
17
|
|
|
@@ -20,16 +22,21 @@ const colors = {
|
|
|
20
22
|
magenta: '\x1b[35m',
|
|
21
23
|
};
|
|
22
24
|
|
|
25
|
+
if (argv.v) {
|
|
26
|
+
console.log(pkg.version);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
if (argv.h || argv._.length < 1) {
|
|
24
31
|
console.error(
|
|
25
|
-
`JSON Schema Bundler
|
|
26
|
-
process.env['JSON_SCHEMA_BUNDLER_VERSION'],
|
|
32
|
+
`JSON Schema Bundler\n\n${colors.yellow}Usage:${colors.end}\n %s\n\n${colors.yellow}Arguments:${colors.end}\n %s\n\n${colors.yellow}Options:${colors.end}\n %s\n\n${colors.yellow}Examples:${colors.end}\n %s`,
|
|
27
33
|
`${path.basename(process.argv[1])} [options] <input>`,
|
|
28
34
|
`${colors.green}input${colors.end} The path or URL of the input schema file`,
|
|
29
35
|
[
|
|
30
|
-
`${colors.green}-h, --help${colors.end}
|
|
31
|
-
`${colors.green}-p, --pretty${colors.end}
|
|
32
|
-
`${colors.green}-s, --silent${colors.end}
|
|
36
|
+
`${colors.green}-h, --help${colors.end} Display this help message`,
|
|
37
|
+
`${colors.green}-p, --pretty${colors.end} Pretty print output`,
|
|
38
|
+
`${colors.green}-s, --silent${colors.end} Silent mode`,
|
|
39
|
+
`${colors.green}-v, --version${colors.end} Print version number`,
|
|
33
40
|
].join('\n '),
|
|
34
41
|
[
|
|
35
42
|
[
|
package/package.json
CHANGED
package/schema.json
DELETED
package/schema2.json
DELETED