From e5ccbe5c1294e2b32daaedf6310e741be2fe796d Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 31 Oct 2022 10:24:43 -0700 Subject: [PATCH] Install referenced schema in "Check npm" workflow The "Check npm" GitHub Actions workflow validates the repository's `package.json` npm manifest file against its JSON schema to catch any problems with its data format. In order to avoid duplication of content, JSON schemas may reference other schemas via the `$ref` keyword. The `package.json` schema was recently updated to share resources with the npm-badges configuration schema, which caused the validation to start failing: schema /home/runner/work/_temp/json-schema/package-json-schema.json is invalid error: can't resolve reference https://json.schemastore.org/npm-badges.json from id # The solution is to configure the workflow to download that schema as well and also to provide its path to the avj-cli validator via an `-r` flag. --- Taskfile.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Taskfile.yml b/Taskfile.yml index c01769e..b1b7a0c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -187,6 +187,10 @@ tasks: JSCPD_SCHEMA_URL: https://json.schemastore.org/jscpd.json JSCPD_SCHEMA_PATH: sh: task utility:mktemp-file TEMPLATE="jscpd-schema-XXXXXXXXXX.json" + # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/npm-badges.json + NPM_BADGES_SCHEMA_URL: https://json.schemastore.org/npm-badges.json + NPM_BADGES_SCHEMA_PATH: + sh: task utility:mktemp-file TEMPLATE="npm-badges-schema-XXXXXXXXXX.json" # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/prettierrc.json PRETTIERRC_SCHEMA_URL: https://json.schemastore.org/prettierrc.json PRETTIERRC_SCHEMA_PATH: @@ -209,6 +213,7 @@ tasks: - wget --quiet --output-document="{{.AVA_SCHEMA_PATH}}" {{.AVA_SCHEMA_URL}} - wget --quiet --output-document="{{.ESLINTRC_SCHEMA_PATH}}" {{.ESLINTRC_SCHEMA_URL}} - wget --quiet --output-document="{{.JSCPD_SCHEMA_PATH}}" {{.JSCPD_SCHEMA_URL}} + - wget --quiet --output-document="{{.NPM_BADGES_SCHEMA_PATH}}" {{.NPM_BADGES_SCHEMA_URL}} - wget --quiet --output-document="{{.PRETTIERRC_SCHEMA_PATH}}" {{.PRETTIERRC_SCHEMA_URL}} - wget --quiet --output-document="{{.SEMANTIC_RELEASE_SCHEMA_PATH}}" {{.SEMANTIC_RELEASE_SCHEMA_URL}} - wget --quiet --output-document="{{.STYLELINTRC_SCHEMA_PATH}}" {{.STYLELINTRC_SCHEMA_URL}} @@ -220,6 +225,7 @@ tasks: -r "{{.AVA_SCHEMA_PATH}}" \ -r "{{.ESLINTRC_SCHEMA_PATH}}" \ -r "{{.JSCPD_SCHEMA_PATH}}" \ + -r "{{.NPM_BADGES_SCHEMA_PATH}}" \ -r "{{.PRETTIERRC_SCHEMA_PATH}}" \ -r "{{.SEMANTIC_RELEASE_SCHEMA_PATH}}" \ -r "{{.STYLELINTRC_SCHEMA_PATH}}" \