mtcute/packages/core/scripts/generate-app-config.cjs

26 lines
676 B
JavaScript
Raw Normal View History

const fs = require('node:fs')
const path = require('node:path')
2024-02-05 01:44:51 +03:00
const spec = require('@mtcute/tl/app-config.json')
const OUT_FILE = path.join(__dirname, '../src/highlevel/types/misc/app-config.ts')
const out = fs.createWriteStream(OUT_FILE)
out.write(`// This file is generated automatically, do not modify!
/* eslint-disable */
export interface AppConfigSchema {
`)
const indent = str => str.split('\n').map(x => ` ${x}`).join('\n')
2024-02-05 01:44:51 +03:00
for (const [key, { type, description }] of Object.entries(spec)) {
out.write(`${indent(description)}\n`)
out.write(`${indent(`${key}?: ${type}`)}\n`)
2024-02-05 01:44:51 +03:00
}
out.write(' [key: string]: unknown\n')
out.write('}\n')
out.close()