@@ -20,7 +20,7 @@ const defaultConfig = {
2020
2121const runOptions = {
2222 prMode : false ,
23- configFolder : '' ,
23+ configLocation : '' ,
2424} ;
2525export function getRunOptions ( ) : typeof runOptions {
2626 return runOptions ;
@@ -29,18 +29,18 @@ export function setRunOptions(flags: Partial<typeof runOptions>) {
2929 Object . assign ( runOptions , flags ) ;
3030}
3131
32- // function to get the configuration
33-
3432async function findFirstFile ( folderPath : string , files : string [ ] ) {
33+ const getFile = async ( file : string ) => ( {
34+ data : await readFile ( file , 'utf-8' ) ,
35+ path : file ,
36+ } ) ;
37+ const isAlreadyFilepath = files . find ( f => folderPath . endsWith ( f ) ) ;
38+ if ( isAlreadyFilepath && existsSync ( folderPath ) ) {
39+ return getFile ( folderPath ) ;
40+ }
3541 for ( const file of files ) {
3642 const filePath = path . join ( folderPath , file ) ;
37-
38- if ( existsSync ( filePath ) ) {
39- return {
40- data : await readFile ( filePath , 'utf-8' ) ,
41- path : filePath ,
42- } ;
43- }
43+ if ( existsSync ( filePath ) ) return getFile ( filePath ) ;
4444 }
4545
4646 return null ;
@@ -92,7 +92,7 @@ export async function getConfig(): Promise<VendorsOptions> {
9292 if ( res ) return res ;
9393
9494 const folderPath = await realpath (
95- runOptions . configFolder ||
95+ runOptions . configLocation ||
9696 process . env . INIT_CWD ||
9797 process . env . PWD ||
9898 process . cwd ( ) ,
0 commit comments