export async function importResourceType()

in src/index.ts [21:34]


export async function importResourceType(resourceName: string, _resourceVersion: string, options: ImportResourceTypeOptions): Promise<string> {
  const outdir = options.outdir ?? '.';
  const type = await describeResourceType(resourceName, options);

  const typeSchema = JSON.parse(type.Schema!);

  const gen = new CfnResourceGenerator(type.TypeName, type, typeSchema);

  fs.mkdirSync(outdir, { recursive: true });

  fs.writeFileSync(path.join(outdir, 'index.ts'), gen.render());

  return type.TypeName;
};