build: Prettify schema.json using the correct config (#15637)

This commit is contained in:
Danny Martini
2025-05-27 15:49:12 +02:00
committed by GitHub
parent 9141e2a11d
commit f062e260f4
2 changed files with 16 additions and 58 deletions

View File

@@ -3,7 +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';
import { format, resolveConfig } from 'prettier';
const __dirname = dirname(fileURLToPath(import.meta.url));
const rootDir = resolve(__dirname, '..');
@@ -15,7 +15,8 @@ const jsonSchema = zodToJsonSchema(extensionManifestSchema, {
(async () => {
const filepath = 'schema.json';
const schema = JSON.stringify(jsonSchema, null, 2);
const formattedSchema = await format(schema, { filepath: filepath });
const schema = JSON.stringify(jsonSchema);
const config = await resolveConfig(filepath);
const formattedSchema = await format(schema, { ...config, filepath });
await writeFile(resolve(rootDir, filepath), formattedSchema);
})();