mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
build: Prettify schema.json before writing it (#15600)
This commit is contained in:
@@ -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);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user