@@ -484,25 +484,25 @@ export function getIgnore (target:string, ignoreFileNames: string): Ignore {
484484 const ig = ignore ( )
485485 const files = ignoreFileNames . split ( ',' ) . filter ( Boolean )
486486 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 )
493490 } )
494491 return ig
495492}
496493
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 )
499497 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+ } )
506506 debug ( `ignoreTargets ${ ignoreTargets } ` )
507507 return ignoreTargets
508508}
0 commit comments