feat: more fixes

This commit is contained in:
2023-11-01 16:10:12 +01:00
parent 4bdd4b20d0
commit 62d5ea4275
23 changed files with 80 additions and 289 deletions

View File

@@ -24,10 +24,10 @@ export function compileSchema(path: string, tsconfig: string): [schma: JSONSchem
Object.assign(fullSchema.definitions, generator.createSchema(schema).definitions);
}
const schemaTypes = `import {JSONSchema7} from 'json-schema';\n\nexport interface SchemaMap {\n${[
const schemaTypes = `import {JSONSchema7} from 'json-schema';\nimport * as index from './index.js';\n\nexport interface SchemaMap {\n${[
...schemaNames,
]
.map(schemaName => ` '${schemaName}': core.${schemaName};`)
.map(schemaName => ` '${schemaName}': index.${schemaName};`)
.join('\n')}\n}\n\nconst schema: JSONSchema7;\nexport default schema;`;
return [fullSchema, schemaTypes];

View File

@@ -76,7 +76,7 @@ export function jsonSchemaPlugin(
return {
[schemaName]: JSON.stringify(jsonSchema),
[`${schemaName.replace(/\.json$/, '')}.d.ts`]: types,
[`${schemaName}.d.ts`]: types,
};
}).call(this);