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

View File

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