8

I have the following folder structure:

foo1/
  node_modules/
foo2/
  node_modules/
  bar/
    node_modules/
.tfignore

A single .tfignore file is in the root directory.

What should I add to the .tfignore in order to ignore node_modules directories recursively no matter where they are in the directory hierarchy?


There're a lot of questions similar to mine. But all are pretty wide. I want to keep it simple. Please don't suggest anything with "Pending Changes". I only need a single line in .tfignore

scor4er
  • 1,580
  • 12
  • 23
  • 1
    What have you tried? Have you tried just adding `node_modules` to your `.tfignore`? What do your pending changes look like when you do? – Edward Thomson Apr 17 '18 at 16:29
  • @EdwardThomson, I feel awkward, but you're right. Simple `node_modules` did it. I tried \\**\node_modules\, \\*\node_modules\ and it wasn't working. – scor4er Apr 17 '18 at 16:55
  • @EdwardThomson you could post your answer and I'll accept it. Just in case anybody's as silly as I. – scor4er Apr 17 '18 at 16:58
  • No need to feel awkward - I couldn't remember how `.tfignore` worked and I shipped that code. – Edward Thomson Apr 18 '18 at 00:01

1 Answers1

11

The .tfignore file will ignore the given pattern in all subdirectories (unless otherwise specified). And it will ignore files or folders with the given name. For folders, it will apply recursively.

As a result, a .tfignore with:

node_modules

will ignore any folder named node_modules in your filesystem hierarchy, and it will ignore them recursively.

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187