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