Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: sourcemeta/jsonschema@v12.6.0
- uses: actions/checkout@v4
- run: make lint
- run: make test
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: sourcemeta/jsonschema@v12.6.0
- uses: actions/checkout@v4
- run: make lint
- run: make test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
/build
/dist
/node_modules
33 changes: 18 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DEFAULT_GOAL := all

JSONSCHEMA ?= jsonschema
JSONSCHEMA ?= ./node_modules/@sourcemeta/jsonschema/cli.js
JQ ?= jq
SHELLCHECK ?= shellcheck
TAR ?= tar
Expand All @@ -15,30 +15,30 @@ NPM ?= npm
include generated.mk

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

.PHONY: common
common: $(GENERATED)
$(JSONSCHEMA) metaschema schemas meta
$(JSONSCHEMA) lint schemas meta
$(JSONSCHEMA) validate meta/schemas-root.json schemas
$(JSONSCHEMA) validate meta/schemas.json schemas
$(JSONSCHEMA) validate meta/test.json test
common: $(GENERATED) node_modules
$(NODE) $(JSONSCHEMA) metaschema schemas meta
$(NODE) $(JSONSCHEMA) lint schemas meta
$(NODE) $(JSONSCHEMA) validate meta/schemas-root.json schemas
$(NODE) $(JSONSCHEMA) validate meta/schemas.json schemas
$(NODE) $(JSONSCHEMA) validate meta/test.json test
$(SHELLCHECK) scripts/*.sh
./scripts/quality-schemas-tests-mirror.sh
./scripts/quality-templates-xbrl-utr-mirror.sh

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

.PHONY: test
test:
$(JSONSCHEMA) test ./test
test: node_modules
$(NODE) $(JSONSCHEMA) test ./test
$(NODE) npm/cjs.test.js
$(NODE) npm/esm.test.mjs

Expand All @@ -58,3 +58,6 @@ dist:
$(MKDIRP) $@/npm
$(NPM) version --no-git-tag-version --allow-same-version "$(VERSION)"
$(NPM) pack --pack-destination $@/npm

node_modules: package.json package-lock.json
$(NPM) ci
4 changes: 2 additions & 2 deletions generated.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PYTHON ?= python3

define MAKE_SCHEMA
schemas/$1.json: templates/schemas/$1.jq $2.json
schemas/$1.json: templates/schemas/$1.jq $2.json node_modules
$(MKDIRP) $$(dir $$@)
$(JQ) --from-file $$< $$(word 2,$$^) > $$@
$(JSONSCHEMA) fmt $$@
$(NODE) $(JSONSCHEMA) fmt $$@
GENERATED += schemas/$1.json
endef

Expand Down
44 changes: 44 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@
"publishConfig": {
"provenance": true,
"access": "public"
},
"devDependencies": {
"@sourcemeta/jsonschema": "^12.7.1"
}
}