import * as fs from "fs" ; import { DirectoryUtil } from "../utils/DirectoryUtil" ; import { IRoute } from "../structures/IRoute" ; import { FileGenerator } from "./FileGenerator" ; export namespace SdkGenerator { export async function generate ( outDir , routeList ) { try { await fs . promises . mkdir ( outDir ) ; } catch { } const bundle = await fs . promises . readdir ( BUNDLE ) ; for ( const file of bundle ) { const current = `${ BUNDLE }/${ file }` ; const stats = await fs . promises . stat ( current ) ; if ( stats . isFile ( ) === true ) { const content = await fs . promises . readFile ( current , "utf8" ) ; await fs . promises . writeFile ( `${ outDir }/${ file }` , content , "utf8" ) ; } } await DirectoryUtil . copy ( BUNDLE + "/__internal" , outDir + "/__internal" ) ; await FileGenerator . generate ( outDir , routeList ) ; } } const BUNDLE = __dirname + "/../bundle" ;