import { ITypeDraftConfig } from "./literator" ; import { cosmiconfig } from "cosmiconfig" ; import { default as tsLoader } from "@endemolshinegroup/cosmiconfig-typescript-loader" ; const explorer = cosmiconfig ( "typedraft" , { searchPlaces : [ `typedraft.config.ts` ] , loaders : { ".ts" : tsLoader , } , } ) ; export function withConfig ( callback ) { explorer . search ( ) . then ( configInfo => { let config = { DSLs : [ ] , DraftPlugins : [ ] , Targets : [ ] } ; if ( configInfo && ! configInfo . isEmpty ) { config = { ... config , ... configInfo . config } ; } callback ( config ) ; } ) ; }