import AwaitEventEmitter from 'await-event-emitter/types' ; import { Project } from 'ts-morph' ; import { generateFileName } from './generate-file-name' ; export function factoryGetSourceFile ( args ) { const { outputFilePattern , output , getModelName , project } = args ; return function getSourceFile ( args ) { const { name , type } = args ; let filePath = generateFileName ( { getModelName , name , type , template : outputFilePattern , } ) ; filePath = `${ output }/${ filePath }` ; return project . getSourceFile ( filePath ) || project . createSourceFile ( filePath ) ; } ; }