Nodemon: No ability to turn of watching

Created on 2 Mar 2015  ·  4Comments  ·  Source: remy/nodemon

I'm using nodemon with gulp and I have a set of tasks that should be run sequentially on file change.
I'm using gulp's watch and send restart from one of these tasks to nodemon.
All is fine except that in this scenario I don't need nodemon to watch any files, because gulp already does it.

Unfortunately there is no way to turn off watching in nodemon.

Moreover, I cannot even make it watch as little as possible - it always adds something like **/ to the paths I provide.
Of course I can use "ignore" option, but it would be much better to be able to specify that I don't need to watch anything at all.

PS It also would be cool to be able to specify what exactly I want to watch without unexpectedly adding prefixes or enforcing defaults (nodemon is very aggressive on this).

Most helpful comment

You can now do watch: false to optionally _not_ watch anything. This is rather specific to your problem, but it was simple to add.

All 4 comments

Can you replicate this without using gulp (as its a totally separate
project which does its own thing with nodemon)?
On 2 Mar 2015 18:53, "Dmitry Smolin" [email protected] wrote:

I'm using nodemon with gulp and I have a set of tasks that should be run
sequentially on file change.
I'm using gulp's watch and send restart from one of these tasks to nodemon.
All is fine except that in this scenario I don't need nodemon to watch any
files, because gulp already does it.

Unfortunately there is no way to turn off watching in nodemon.

Moreover, I cannot even make it watch as little as possible - it always
adds something like **/ to the paths I provide.
Of course I can use "ignore" option, but it would be much better to be
able to specify that I don't need to watch anything at all.

PS It also would be cool to be able to specify what exactly I want to
watch without unexpectedly adding prefixes or enforcing defaults (nodemon
is very aggressive on this).


Reply to this email directly or view it on GitHub
https://github.com/remy/nodemon/issues/516.

I think I can.
But how I supposed to turn off watching? I just didn't find such an option.
And all my attempts to use options like watch: false, watch: [], watch: '', watch: [''] (and so on) have failed.
I traced the sources and found that nodemon uses default dirs to watch on any attempt to provide some kind of "nothing" as an option.

For instance:

  • this line applies defaults even when empty list is intentionally provided
  • this line adds *.* to watch list even if defaults weren't applied (will prevent empty watch list even if previous item will be fixed)

Also it looks like this line adds **/ prefix to rules, so you cannot specify some concrete file or directory, it will forcefully become **/somedir

You can now do watch: false to optionally _not_ watch anything. This is rather specific to your problem, but it was simple to add.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabianMendez picture fabianMendez  ·  4Comments

remy picture remy  ·  5Comments

Autre31415 picture Autre31415  ·  4Comments

robboerman picture robboerman  ·  3Comments

jonerer picture jonerer  ·  4Comments