2024-08-13 04:53:07 +03:00
|
|
|
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 {
|
|
|
|
`)
|
|
|
|
|
2024-08-13 04:53:07 +03:00
|
|
|
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)) {
|
2024-08-13 04:53:07 +03:00
|
|
|
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()
|