adamreisnz / replace-in-file

A simple utility to quickly replace contents in one or more files
580 stars 65 forks source link

The ignore option doesn't seem to work #167

Closed jpage-godaddy closed 1 year ago

jpage-godaddy commented 1 year ago

I'm doing a replaceInFile call like this:

replaceInFile({
  files: '/some/path/**',
  countMatches: true,
  ignore: ['node_modules'],
  from: /foo/g,
  to: 'bar',
  glob: {
    dot: true
  }
})

...but ignore doesn't seem to be working because I'm getting an error:

[Error: ENOENT: no such file or directory, open '/some/path/blah/node_modules/.bin/some-cli'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/some/path/blah/node_modules/.bin/some-cli'
}

Any idea why this is trying to open files that should be ignored? I've also tried node_modules/**, node_modules/**/*, etc.

jpage-godaddy commented 1 year ago

Debugged this... **/node_modules/** works instead.