Roo-Code/scripts/generate-types.mts
Afshawn Lotfi cbe7075f4f
In-Editor Browser Improvements (#1601)
* Browser Automation Improvements
* Added multi-tab remote Chrome support
* Added support for hover
* Properly caching remote browser host in global state
* Cleanup functions

* Updated for changes after merge

* Added www. exception for common tabs

* Update src/core/webview/ClineProvider.ts

* Revert README changes

---------

Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
2025-03-29 00:46:01 -04:00

27 lines
840 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 $`npx prettier --write src/exports/types.ts src/exports/roo-code.d.ts`
}
main()