mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 16:13:06 +00:00
15 lines
498 B
JavaScript
15 lines
498 B
JavaScript
// @ts-check
|
|
|
|
import {writeFile, readFile} from 'fs/promises';
|
|
|
|
const schemaNames = Object.keys(
|
|
JSON.parse(await readFile('schema/core.schema.json', 'utf8')).definitions,
|
|
).filter(it => /^[a-z][0-9a-z<>]*$/i.test(it));
|
|
const source =
|
|
"import type * as core from '@openstapps/core';\n\n" +
|
|
'export interface SchemaMap {\n' +
|
|
schemaNames.map(name => ` '${name}': core.${name.replaceAll('<', '<core.')};`).join('\n') +
|
|
'\n}\n';
|
|
|
|
await writeFile('schema/core.schema.d.ts', source, 'utf8');
|