-
-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace unmaintained ajv-cli with custom script (#2352)
- Loading branch information
Showing
3 changed files
with
21 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,12 @@ | |
"author": "Tejas Bubane <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"ajv-cli": "^5.0.0", | ||
"ajv": "^8.12.0", | ||
"prettier": "^3.1.1" | ||
}, | ||
"scripts": { | ||
"test": "ajv --strict=false -s canonical-data.schema.json -d \"exercises/*/canonical-data.json\"", | ||
"test-one": "ajv --strict=false -s canonical-data.schema.json -d", | ||
"test": "node validate.js exercises/*/canonical-data.json", | ||
"test-one": "node validate.js", | ||
"format-json": "prettier --write **/*.json", | ||
"format-md": "prettier --write **/*.md" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const Ajv = require("ajv"); | ||
const fs = require("fs"); | ||
|
||
const schema = JSON.parse(fs.readFileSync("canonical-data.schema.json")); | ||
// strict: false allows to use keywords that are not part | ||
// of the JSON Schema specification | ||
const validate = new Ajv({ strict: false }).compile(schema); | ||
|
||
const exercises = process.argv.slice(2); | ||
|
||
for (e of exercises) { | ||
const data = JSON.parse(fs.readFileSync(e)); | ||
if (!validate(data)) { | ||
console.error(validate.errors); | ||
process.exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,20 +2,7 @@ | |
# yarn lockfile v1 | ||
|
||
|
||
ajv-cli@^5.0.0: | ||
version "5.0.0" | ||
resolved "https://registry.yarnpkg.com/ajv-cli/-/ajv-cli-5.0.0.tgz#78956ed2934e6dde4c9e696b587be1c2998862e8" | ||
integrity sha512-LY4m6dUv44HTyhV+u2z5uX4EhPYTM38Iv1jdgDJJJCyOOuqB8KtZEGjPZ2T+sh5ZIJrXUfgErYx/j3gLd3+PlQ== | ||
dependencies: | ||
ajv "^8.0.0" | ||
fast-json-patch "^2.0.0" | ||
glob "^7.1.0" | ||
js-yaml "^3.14.0" | ||
json-schema-migrate "^2.0.0" | ||
json5 "^2.1.3" | ||
minimist "^1.2.0" | ||
|
||
ajv@^8.0.0: | ||
ajv@^8.12.0: | ||
version "8.12.0" | ||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" | ||
integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== | ||
|
@@ -25,132 +12,16 @@ ajv@^8.0.0: | |
require-from-string "^2.0.2" | ||
uri-js "^4.2.2" | ||
|
||
argparse@^1.0.7: | ||
version "1.0.10" | ||
resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" | ||
integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== | ||
dependencies: | ||
sprintf-js "~1.0.2" | ||
|
||
balanced-match@^1.0.0: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" | ||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== | ||
|
||
brace-expansion@^1.1.7: | ||
version "1.1.11" | ||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" | ||
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== | ||
dependencies: | ||
balanced-match "^1.0.0" | ||
concat-map "0.0.1" | ||
|
||
[email protected]: | ||
version "0.0.1" | ||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" | ||
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== | ||
|
||
esprima@^4.0.0: | ||
version "4.0.1" | ||
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" | ||
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== | ||
|
||
fast-deep-equal@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz" | ||
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= | ||
|
||
fast-deep-equal@^3.1.1: | ||
version "3.1.3" | ||
resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" | ||
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== | ||
|
||
fast-json-patch@^2.0.0: | ||
version "2.2.1" | ||
resolved "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.2.1.tgz" | ||
integrity sha512-4j5uBaTnsYAV5ebkidvxiLUYOwjQ+JSFljeqfTxCrH9bDmlCQaOJFS84oDJ2rAXZq2yskmk3ORfoP9DCwqFNig== | ||
dependencies: | ||
fast-deep-equal "^2.0.1" | ||
|
||
fs.realpath@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" | ||
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= | ||
|
||
glob@^7.1.0: | ||
version "7.1.6" | ||
resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz" | ||
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== | ||
dependencies: | ||
fs.realpath "^1.0.0" | ||
inflight "^1.0.4" | ||
inherits "2" | ||
minimatch "^3.0.4" | ||
once "^1.3.0" | ||
path-is-absolute "^1.0.0" | ||
|
||
inflight@^1.0.4: | ||
version "1.0.6" | ||
resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" | ||
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= | ||
dependencies: | ||
once "^1.3.0" | ||
wrappy "1" | ||
|
||
inherits@2: | ||
version "2.0.3" | ||
resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" | ||
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= | ||
|
||
js-yaml@^3.14.0: | ||
version "3.14.1" | ||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" | ||
integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== | ||
dependencies: | ||
argparse "^1.0.7" | ||
esprima "^4.0.0" | ||
|
||
json-schema-migrate@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/json-schema-migrate/-/json-schema-migrate-2.0.0.tgz#335ef5218cd32fcc96c1ddce66c71ba586224496" | ||
integrity sha512-r38SVTtojDRp4eD6WsCqiE0eNDt4v1WalBXb9cyZYw9ai5cGtBwzRNWjHzJl38w6TxFkXAIA7h+fyX3tnrAFhQ== | ||
dependencies: | ||
ajv "^8.0.0" | ||
|
||
json-schema-traverse@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" | ||
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== | ||
|
||
json5@^2.1.3: | ||
version "2.2.3" | ||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" | ||
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== | ||
|
||
minimatch@^3.0.4: | ||
version "3.1.2" | ||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" | ||
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== | ||
dependencies: | ||
brace-expansion "^1.1.7" | ||
|
||
minimist@^1.2.0: | ||
version "1.2.6" | ||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" | ||
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== | ||
|
||
once@^1.3.0: | ||
version "1.4.0" | ||
resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" | ||
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= | ||
dependencies: | ||
wrappy "1" | ||
|
||
path-is-absolute@^1.0.0: | ||
version "1.0.1" | ||
resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" | ||
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= | ||
|
||
prettier@^3.1.1: | ||
version "3.1.1" | ||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.1.tgz#6ba9f23165d690b6cbdaa88cb0807278f7019848" | ||
|
@@ -166,19 +37,9 @@ require-from-string@^2.0.2: | |
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" | ||
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== | ||
|
||
sprintf-js@~1.0.2: | ||
version "1.0.3" | ||
resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" | ||
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= | ||
|
||
uri-js@^4.2.2: | ||
version "4.4.0" | ||
resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz" | ||
integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g== | ||
dependencies: | ||
punycode "^2.1.0" | ||
|
||
wrappy@1: | ||
version "1.0.2" | ||
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" | ||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= |