@@ -477,25 +477,25 @@ export function getIgnore (target:string, ignoreFileNames: string): Ignore {
477
477
const ig = ignore ( )
478
478
const files = ignoreFileNames . split ( ',' ) . filter ( Boolean )
479
479
files . forEach ( file => {
480
- const fullPath = resolve ( path . join ( target , path . normalize ( file ) ) )
481
- debug ( 'getIgnore: fullpath' , fullPath , fs . existsSync ( fullPath ) )
482
- if ( fs . existsSync ( fullPath ) ) {
483
- const ignoreFiles = readIgnoreFile ( fullPath )
484
- returnIgnoreInstance ( ig , ignoreFiles )
485
- }
480
+ debug ( 'ignore target file' , file )
481
+ const ignoreFiles = readIgnoreFile ( target , file )
482
+ returnIgnoreInstance ( ig , ignoreFiles )
486
483
} )
487
484
return ig
488
485
}
489
486
490
- function readIgnoreFile ( ignoreFile : string ) : string [ ] {
491
- debug ( 'readIgnoreFile: ignoreFile' , ignoreFile )
487
+ function readIgnoreFile ( target : string , _ignoreFile : string ) : string [ ] {
488
+ const ignoreFiles = glob . sync ( `${ target } /**/${ _ignoreFile } ` )
489
+ debug ( 'readIgnoreFile: ignoreFiles' , ignoreFiles )
492
490
const ignoreTargets = [ ] as string [ ]
493
- fs . readFileSync ( ignoreFile , 'utf8' )
494
- . split ( / \r ? \n / g)
495
- . filter ( Boolean )
496
- . forEach ( ignoreTarget => {
497
- ignoreTargets . push ( formatPath ( ignoreFile , ignoreTarget ) )
498
- } )
491
+ ignoreFiles . forEach ( ignoreFile => {
492
+ fs . readFileSync ( ignoreFile , 'utf8' )
493
+ . split ( / \r ? \n / g)
494
+ . filter ( Boolean )
495
+ . forEach ( ignoreTarget => {
496
+ ignoreTargets . push ( formatPath ( ignoreFile , ignoreTarget ) )
497
+ } )
498
+ } )
499
499
debug ( `ignoreTargets ${ ignoreTargets } ` )
500
500
return ignoreTargets
501
501
}
0 commit comments