import { Config } from './types' ; import { findConfigFile , findPackageJsonFile , readJson } from './utils' ; export interface ConfigFromFileResult { usedConfigFile : boolean ; usedPackageJson : boolean ; config : Partial < Config > ; } export function readConfigFromFile ( opts ) { const configFile = opts . configFile || findConfigFile ( process . cwd ( ) ) ; const packageJsonFile = findPackageJsonFile ( process . cwd ( ) ) ; const configByConfigFile = ! configFile ? { } : readJson ( configFile ) ; const configByPackageJson = ! packageJsonFile ? { } : readJson ( packageJsonFile ) . tsToOpenAPI ; const config = Object . assign ( { } , configByConfigFile , configByPackageJson ) ; return { usedConfigFile : ! ! configFile , usedPackageJson : ! ! packageJsonFile , config , } ; }