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

@@ -1,68 +1,29 @@
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"displayName": {
"type": "string"
},
"description": {
"type": "string"
},
"publisher": {
"type": "string"
},
"version": {
"type": "string"
},
"categories": {
"type": "array",
"items": {
"type": "string"
}
},
"name": { "type": "string" },
"displayName": { "type": "string" },
"description": { "type": "string" },
"publisher": { "type": "string" },
"version": { "type": "string" },
"categories": { "type": "array", "items": { "type": "string" } },
"entry": {
"type": "object",
"properties": {
"backend": {
"type": "string"
},
"frontend": {
"type": "string"
}
},
"properties": { "backend": { "type": "string" }, "frontend": { "type": "string" } },
"required": ["backend", "frontend"],
"additionalProperties": false
},
"minSDKVersion": {
"type": "string"
},
"minSDKVersion": { "type": "string" },
"permissions": {
"type": "object",
"properties": {
"frontend": {
"type": "array",
"items": {
"type": "string"
}
},
"backend": {
"type": "array",
"items": {
"type": "string"
}
}
"frontend": { "type": "array", "items": { "type": "string" } },
"backend": { "type": "array", "items": { "type": "string" } }
},
"required": ["frontend", "backend"],
"additionalProperties": false
},
"events": {
"type": "array",
"items": {
"type": "string"
}
},
"events": { "type": "array", "items": { "type": "string" } },
"extends": {
"type": "object",
"properties": {
@@ -71,11 +32,7 @@
"properties": {
"workflows": {
"type": "object",
"properties": {
"header": {
"type": "string"
}
},
"properties": { "header": { "type": "string" } },
"required": ["header"],
"additionalProperties": false
}

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);
})();