import { join } from 'path' ; import { Project } from 'ts-morph' ; import { producedDirname } from '../utils/paths' ; import saveSourceFile from '../utils/saveSourceFile' ; export async function genServer ( ) { const outPath = join ( process . cwd ( ) , producedDirname , 'server.ts' ) ; const project = new Project ( ) ; const sourceFile = project . createSourceFile ( outPath , undefined , { overwrite : true , } ) ; sourceFile . addStatements ( `import { createApp } from '@tiejs/core'
import { config } from './config'

const app = createApp(config as any)
app.bootstrap()
` ) ; await saveSourceFile ( sourceFile ) ; }