import { join, resolve } from 'path';
import { writeFileSync } from 'fs';
import { compileFromFile } from 'json-schema-to-typescript';
import { resolveCurrentPath } from '../util/fs/resolveCurrentPath.js';
export default async function main(schemas) {
    const { directoryPath } = resolveCurrentPath();
    const typesDir = resolve(directoryPath, '..', 'types');
    const schemaDir = resolve(directoryPath, '..', 'schemas');
    return await Promise.all(schemas.map((name) => compileFromFile(join(schemaDir, `${name}.json`), {
        cwd: schemaDir,
        style: {
            singleQuote: true,
        },
    }).then((ts) => writeFileSync(join(typesDir, `_${name}.d.ts`), ts))));
}
main(['system', 'variant', 'emulsifyProjectConfig']);
