initial 2 commit

This commit is contained in:
2023-07-09 17:49:33 +02:00
parent 732f728ff8
commit 7c11ba18fd
34 changed files with 1222 additions and 0 deletions

17
scripts/generateSchema.ts Normal file
View File

@@ -0,0 +1,17 @@
import { mkdir, rm, writeFile } from 'node:fs/promises'
import { zodToJsonSchema } from 'zod-to-json-schema'
import { ConfigSchema } from '../src/config/schema/config'
const OUTPUT = './schema'
await rm(OUTPUT, { recursive: true, force: true })
await mkdir(OUTPUT, { recursive: true })
const Schemas = {
config: ConfigSchema,
}
for (const [name, schema] of Object.entries(Schemas)) {
const jsonSchema = zodToJsonSchema(schema, 'mySchema')
await writeFile(`${OUTPUT}/${name}.json`, JSON.stringify(jsonSchema, null, 2), { encoding: 'utf-8' })
}