Skip to content

Commit bfc07dc

Browse files
committed
Pull the JSON Schema CLI through NPM
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent feed2d2 commit bfc07dc

File tree

6 files changed

+66
-17
lines changed

6 files changed

+66
-17
lines changed

.github/workflows/cd.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
package:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: sourcemeta/jsonschema@v12.6.0
2221
- uses: actions/checkout@v4
2322
- run: make lint
2423
- run: make test

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
test:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: sourcemeta/jsonschema@v12.6.0
2120
- uses: actions/checkout@v4
2221
- run: make lint
2322
- run: make test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
22
/build
33
/dist
4+
/node_modules

Makefile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DEFAULT_GOAL := all
22

3-
JSONSCHEMA ?= jsonschema
3+
JSONSCHEMA ?= ./node_modules/@sourcemeta/jsonschema/cli.js
44
JQ ?= jq
55
SHELLCHECK ?= shellcheck
66
TAR ?= tar
@@ -15,30 +15,30 @@ NPM ?= npm
1515
include generated.mk
1616

1717
# TODO: Make `jsonschema fmt` automatically detect test files
18-
all: common test
19-
$(JSONSCHEMA) fmt schemas meta
20-
$(JSONSCHEMA) fmt test --default-dialect "https://json-schema.org/draft/2020-12/schema"
18+
all: common test node_modules
19+
$(NODE) $(JSONSCHEMA) fmt schemas meta
20+
$(NODE) $(JSONSCHEMA) fmt test --default-dialect "https://json-schema.org/draft/2020-12/schema"
2121

2222
.PHONY: common
23-
common: $(GENERATED)
24-
$(JSONSCHEMA) metaschema schemas meta
25-
$(JSONSCHEMA) lint schemas meta
26-
$(JSONSCHEMA) validate meta/schemas-root.json schemas
27-
$(JSONSCHEMA) validate meta/schemas.json schemas
28-
$(JSONSCHEMA) validate meta/test.json test
23+
common: $(GENERATED) node_modules
24+
$(NODE) $(JSONSCHEMA) metaschema schemas meta
25+
$(NODE) $(JSONSCHEMA) lint schemas meta
26+
$(NODE) $(JSONSCHEMA) validate meta/schemas-root.json schemas
27+
$(NODE) $(JSONSCHEMA) validate meta/schemas.json schemas
28+
$(NODE) $(JSONSCHEMA) validate meta/test.json test
2929
$(SHELLCHECK) scripts/*.sh
3030
./scripts/quality-schemas-tests-mirror.sh
3131
./scripts/quality-templates-xbrl-utr-mirror.sh
3232

3333
# TODO: Make `jsonschema fmt` automatically detect test files
3434
.PHONY: lint
35-
lint: common
36-
$(JSONSCHEMA) fmt schemas meta --check
37-
$(JSONSCHEMA) fmt test --check --default-dialect "https://json-schema.org/draft/2020-12/schema"
35+
lint: common node_modules
36+
$(NODE) $(JSONSCHEMA) fmt schemas meta --check
37+
$(NODE) $(JSONSCHEMA) fmt test --check --default-dialect "https://json-schema.org/draft/2020-12/schema"
3838

3939
.PHONY: test
40-
test:
41-
$(JSONSCHEMA) test ./test
40+
test: node_modules
41+
$(NODE) $(JSONSCHEMA) test ./test
4242
$(NODE) npm/cjs.test.js
4343
$(NODE) npm/esm.test.mjs
4444

@@ -58,3 +58,6 @@ dist:
5858
$(MKDIRP) $@/npm
5959
$(NPM) version --no-git-tag-version --allow-same-version "$(VERSION)"
6060
$(NPM) pack --pack-destination $@/npm
61+
62+
node_modules: package.json package-lock.json
63+
$(NPM) ci

package-lock.json

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,8 @@
4949
"publishConfig": {
5050
"provenance": true,
5151
"access": "public"
52+
},
53+
"devDependencies": {
54+
"@sourcemeta/jsonschema": "^12.7.1"
5255
}
5356
}

0 commit comments

Comments
 (0)