mirror of
https://github.com/simple-icons/simple-icons.git
synced 2026-10-28 16:44:42 +08:00
28 lines
713 B
JavaScript
28 lines
713 B
JavaScript
#!/usr/bin/env node
|
|
// @ts-check
|
|
/**
|
|
* @file
|
|
* 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, {
|
|
base: new URL('../../.jsonschema.json', import.meta.url).href,
|
|
});
|
|
if (result.errors.length > 0) {
|
|
for (const error of result.errors) {
|
|
console.error(error);
|
|
}
|
|
|
|
console.error(`Found ${result.errors.length} error(s) in simple-icons.json`);
|
|
process.exit(1);
|
|
}
|