Different watch/ignore list for when app has crashed #278

Open
dmmalam opened this Issue Jan 24, 2014 · 2 comments

Projects

None yet

2 participants

dmmalam commented Jan 24, 2014

Is this currently possible:

I use nodemon for web dev, and it restarts correctly when my nodejs app changes. I however use middleware for css (less) and js(browserify) that can each watch their respective files and can rebundle them as necessary. I therefore put the client js / css in my nodemon ignore list. However if I make a error on the css/js file which crashes the process, I then have to manually restart nodemon as it won't detect the file change.

Ideally you should be allowed to optionally specify different files to watch/ignore when a process has crashed. Or is there a simple hack around this that I'm missing?

Owner
remy commented Jan 24, 2014

Can you mock up a simplified example of what you mean (to attempt to
replicate)?
On 24 Jan 2014 23:13, "Dharmesh Malam" notifications@github.com wrote:

Is this currently possible:

I use nodemon for web dev, and it restarts correctly when my nodejs app
changes. I however use middleware for css (less) and js(browserify) that
can each watch their respective files and can rebundle them as necessary. I
therefore put the client js / css in my nodemon ignore list. However if I
make a error on the css/js file which crashes the process, I then have to
manually restart nodemon as it won't detect the file change.

Ideally you should be allowed to optionally specify different files to
watch/ignore when a process has crashed. Or is there a simple hack around
this that I'm missing?


Reply to this email directly or view it on GitHubhttps://github.com/remy/nodemon/issues/278
.

dmmalam commented Jan 26, 2014

So for example:

server.js client.js

In server.js you have say watchify to efficiently recomple client.js on file changes.

I would start nodemon with
nodemon --ignore client.js server.js

And this works perfectly 90% of the time, any change in server.js will be detected by nodemon, and any change in client.js will be taken care of by watchify. However if I make an syntax error in client.js, it will crash watchify, which will then crash server.js. I will then go and fix the error in client.js, and save but nothing will pick this up and I would have to restart the process.

Two workarounds are:

  1. make nodemon also monitor also client.js and get rid of watchify, however this slows down dev hugely as a full startup can take 10+ secs, whereas a watchify rebundle is 1 or 2 secs.
  2. Put a try/catch around watchify, and restart it when a file changes. However this would duplicate the tricky file watch logic in multiple places, and isn't full proof.

Ideally I could give a crash ignore/watch option. ie
nodemon --ignore client.js --crash-watch *.js server.js
so watch for changes in server.js, but then it crashes, also monitor for changes in client.js.

Hope this makes sense, it's a rather niche requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment