2021-02-19 17:19:22 +03:00
|
|
|
const path = require("path");
|
|
|
|
const Validator = require("jsonschema").Validator;
|
|
|
|
|
2021-05-07 20:55:06 +03:00
|
|
|
const rootDir = path.resolve(__dirname, "..", "..");
|
|
|
|
const schemaFile = path.resolve(rootDir, ".jsonschema.json");
|
|
|
|
const dataFile = path.resolve(rootDir, "_data", "simple-icons.json");
|
2021-02-19 17:19:22 +03:00
|
|
|
|
|
|
|
const schema = require(schemaFile);
|
|
|
|
const data = require(dataFile);
|
|
|
|
|
|
|
|
const validator = new Validator();
|
|
|
|
const result = validator.validate(data, schema);
|
|
|
|
if (result.errors.length > 0) {
|
|
|
|
result.errors.forEach((error) => {
|
|
|
|
console.error(error);
|
|
|
|
});
|
|
|
|
|
|
|
|
console.error(`Found ${result.errors.length} error(s) in simple-icons.json`);
|
|
|
|
process.exit(1);
|
|
|
|
}
|