From fbe3830db7522056a425d22aeb8cfe0d274812bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Sat, 9 Nov 2024 16:42:44 +0100 Subject: [PATCH] feat: json $schema locally => `./node_modules/html-w3c-validator/schema/schema.json` --- README.md | 2 +- example/.html-w3c-validatorrc.json | 2 +- package.json | 1 + .../{html-w3c-validatorrc-schema.json => schema.json} | 10 ++++------ .../.html-w3c-validatorrc.json | 2 +- .../.html-w3c-validatorrc.json | 2 +- .../.html-w3c-validatorrc.json | 2 +- .../.html-w3c-validatorrc.json | 2 +- .../.html-w3c-validatorrc.json | 2 +- .../.html-w3c-validatorrc.json | 2 +- .../error-invalid-w3c-html/.html-w3c-validatorrc.json | 2 +- .../fixtures/issue-6/.html-w3c-validatorrc.json | 2 +- .../fixtures/success/.html-w3c-validatorrc.json | 2 +- 13 files changed, 16 insertions(+), 17 deletions(-) rename schema/{html-w3c-validatorrc-schema.json => schema.json} (72%) diff --git a/README.md b/README.md index 9418f37..b453fff 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ npm install --save-dev html-w3c-validator start-server-and-test ```jsonc { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/main/schema/html-w3c-validatorrc-schema.json", + "$schema": "./node_modules/html-w3c-validator/schema/schema.json", // URLs to validate. "urls": ["http://127.0.0.1:3000/", "http://127.0.0.1:3000/about"], diff --git a/example/.html-w3c-validatorrc.json b/example/.html-w3c-validatorrc.json index 1568aa3..c8c2a56 100644 --- a/example/.html-w3c-validatorrc.json +++ b/example/.html-w3c-validatorrc.json @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "./node_modules/html-w3c-validator/schema/schema.json", "urls": ["http://127.0.0.1:3000/", "http://127.0.0.1:3000/about"], "files": ["./build/index.html", "./build/about.html"] } diff --git a/package.json b/package.json index 1244967..960793e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "bin": "build/index.js", "files": [ "build", + "./schema/schema.json", "!**/*.test.js", "!**/*.map" ], diff --git a/schema/html-w3c-validatorrc-schema.json b/schema/schema.json similarity index 72% rename from schema/html-w3c-validatorrc-schema.json rename to schema/schema.json index 517d4b6..09bd90a 100644 --- a/schema/html-w3c-validatorrc-schema.json +++ b/schema/schema.json @@ -1,14 +1,12 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/main/schema/html-w3c-validatorrc-schema.json", + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "html-w3c-validator://config/schema.json", "title": "html-w3c-validator configuration schema", "type": "object", "properties": { "$schema": { - "description": "JSON Schema URI", - "type": "string", - "format": "uri", - "default": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/main/schema/html-w3c-validatorrc-schema.json" + "description": "JSON Schema", + "type": "string" }, "urls": { "description": "URLs to validate.", diff --git a/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json index 2473aa3..39dc3a7 100644 --- a/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-files-and-urls/.html-w3c-validatorrc.json @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "urls": [], "files": [] } diff --git a/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json index ff4f33c..f0f90d1 100644 --- a/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-files/.html-w3c-validatorrc.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "files": "Invalid" } diff --git a/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json index 119db2b..b45efd2 100644 --- a/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-severities-empty/.html-w3c-validatorrc.json @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "files": ["./index.html"], "severities": [] } diff --git a/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json index 309f6fb..4381154 100644 --- a/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-severities/.html-w3c-validatorrc.json @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "files": ["./index.html"], "severities": ["errors-invalid"] } diff --git a/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json index 9354c6b..a1b76cd 100644 --- a/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-config-invalid-urls/.html-w3c-validatorrc.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "urls": "Invalid" } diff --git a/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json index 4dcd737..a290822 100644 --- a/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-invalid-files-paths-to-check/.html-w3c-validatorrc.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "files": ["./index.html"] } diff --git a/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json b/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json index 4d035b7..301c096 100644 --- a/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/error-invalid-w3c-html/.html-w3c-validatorrc.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "files": ["./build/index.html", "./build/about.html"] } diff --git a/src/__test__/fixtures/issue-6/.html-w3c-validatorrc.json b/src/__test__/fixtures/issue-6/.html-w3c-validatorrc.json index bc48c3a..9390726 100644 --- a/src/__test__/fixtures/issue-6/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/issue-6/.html-w3c-validatorrc.json @@ -1,5 +1,5 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/main/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "files": ["./build/index.html"], "severities": ["info", "warning", "error"] } diff --git a/src/__test__/fixtures/success/.html-w3c-validatorrc.json b/src/__test__/fixtures/success/.html-w3c-validatorrc.json index 4d035b7..301c096 100644 --- a/src/__test__/fixtures/success/.html-w3c-validatorrc.json +++ b/src/__test__/fixtures/success/.html-w3c-validatorrc.json @@ -1,4 +1,4 @@ { - "$schema": "https://raw.githubusercontent.com/theoludwig/html-w3c-validator/develop/schema/html-w3c-validatorrc-schema.json", + "$schema": "../../../../schema/schema.json", "files": ["./build/index.html", "./build/about.html"] }