mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
28 lines
910 B
TypeScript
28 lines
910 B
TypeScript
import fs from "fs/promises"
|
|
|
|
import { zodToTs, createTypeAlias, printNode } from "zod-to-ts"
|
|
import { $ } from "execa"
|
|
|
|
import schemas from "../src/schemas"
|
|
const { typeDefinitions } = schemas
|
|
|
|
async function main() {
|
|
const types: string[] = [
|
|
"// This file is automatically generated by running `npm run generate-types`\n// Do not edit it directly.",
|
|
]
|
|
|
|
for (const { schema, identifier } of typeDefinitions) {
|
|
types.push(printNode(createTypeAlias(zodToTs(schema, identifier).node, identifier)))
|
|
types.push(`export type { ${identifier} }`)
|
|
}
|
|
|
|
await fs.writeFile("src/exports/types.ts", types.join("\n\n"))
|
|
|
|
await $`npx tsup src/exports/interface.ts --dts-only -d out`
|
|
await fs.copyFile('out/interface.d.ts', 'src/exports/roo-code.d.ts')
|
|
await fs.copyFile('out/interface.d.ts', 'roo-code-types/index.d.ts')
|
|
|
|
await $`npx prettier --write src/exports/types.ts src/exports/roo-code.d.ts`
|
|
}
|
|
|
|
main()
|