mirror of
https://github.com/Mibew/simple-icons.git
synced 2024-11-17 19:04:13 +03:00
17ea889273
Co-authored-by: LitoMore <LitoMore@users.noreply.github.com>
21 lines
623 B
JavaScript
21 lines
623 B
JavaScript
/**
|
|
* @fileoverview
|
|
* CLI tool to run jsonschema on the simple-icons.json data file.
|
|
*/
|
|
|
|
import process from 'node:process';
|
|
import { Validator } from 'jsonschema';
|
|
import { getIconsData } from '../../sdk.mjs';
|
|
import { getJsonSchemaData } from '../utils.js';
|
|
|
|
const icons = await getIconsData();
|
|
const schema = await getJsonSchemaData();
|
|
|
|
const validator = new Validator();
|
|
const result = validator.validate({ icons }, 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);
|
|
}
|