added schema support on build

This commit is contained in:
Elio
2021-09-18 16:18:46 +02:00
parent 001a49b34e
commit c1c14b814c
2 changed files with 17 additions and 2 deletions
+14
View File
@@ -0,0 +1,14 @@
const fs = require('fs');
const path = require('path');
const pkgJson = require('../../package.json');
if (pkgJson?.contributes?.configuration) {
const schema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://frontmatter.codes/frontmatter.schema.json",
...pkgJson.contributes.configuration
}
fs.writeFileSync(path.join(path.resolve('.'), '/public/frontmatter.schema.json'), JSON.stringify(schema, null, 2));
}