build: Prettify schema.json before writing it (#15600)

This commit is contained in:
Danny Martini
2025-05-23 09:54:57 +02:00
committed by GitHub
parent 4323204070
commit d09c6d8da8

View File

@@ -3,6 +3,7 @@ import { zodToJsonSchema } from 'zod-to-json-schema';
import { writeFile } from 'fs/promises';
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
import { format } from 'prettier';
const __dirname = dirname(fileURLToPath(import.meta.url));
const rootDir = resolve(__dirname, '..');
@@ -13,5 +14,8 @@ const jsonSchema = zodToJsonSchema(extensionManifestSchema, {
});
(async () => {
await writeFile(resolve(rootDir, 'schema.json'), JSON.stringify(jsonSchema, null, 2));
const filepath = 'schema.json';
const schema = JSON.stringify(jsonSchema, null, 2);
const formattedSchema = await format(schema, { filepath: filepath });
await writeFile(resolve(rootDir, filepath), formattedSchema);
})();