@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.
@@ -30,11 +30,23 @@ jobs:
30
30
  node-version: ${{ env.NODE_VERSION }}
31
31
 
32
32
  - name: Install dependencies
33
- run: npm ci
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: Bump package version
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: npm version from-git --no-git-tag-version
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 (latest)
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 Display this help message
34
- -p, --pretty Pretty print output
35
- -s, --silent Silent mode
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 (%s)\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`,
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} Display this help message`,
31
- `${colors.green}-p, --pretty${colors.end} Pretty print output`,
32
- `${colors.green}-s, --silent${colors.end} Silent mode`,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skriptfabrik/json-schema-bundler",
3
- "version": "0.0.0-dev",
3
+ "version": "0.2.0",
4
4
  "description": "The missing CLI for the JSON Schema $Ref Parser",
5
5
  "keywords": [
6
6
  "json",
package/output.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "schema2": {
3
- "foo": "bar"
4
- }
5
- }
package/schema.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "schema2": {
3
- "$ref": "schema2.json"
4
- }
5
- }
package/schema2.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "foo": "bar"
3
- }