mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
feat: improve monorepo dev experience
This commit is contained in:
14
packages/core-validator/compiler/append-schema-map.js
Normal file
14
packages/core-validator/compiler/append-schema-map.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// @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');
|
||||
Reference in New Issue
Block a user