tschaub / grunt-newer

Configure Grunt tasks to run with newer files only.
https://npmjs.org/package/grunt-newer
MIT License
945 stars 61 forks source link

Updates timestamp though task has failed when running from Netbeans/Webstorm #70

Open aszczepanek opened 9 years ago

aszczepanek commented 9 years ago

Many IDEs today have simple integration with grunt. When running task like 'newer:jshint:files' from Netbeans or Webstorm, grunt-newer writes timestamp in his cache directory though jshint task failed due to errors and task newer-post hasn't run.

When running from OS shell the same task it works properly, and timestamp doesn't get overwritten when it shouldn't.

I cannot force other people from project's team to use it from separate console because it's very inconvinient to have one more window, but I would like to speed up jshint. Unfortunately running it from IDE is now pretty useless, because it's easy to fire grunt-watch more than once and miss some errors from JSHint.

I would suggest to not rely on operating system modification date, but instead manually write timestamp to file in .cache directory only in newer-post task.

Updated: I looked a bit more into this issue, and it seems, that newer-postrun task gets fired even though jshint fails, but it doesn't show up in the console.

I probably managed to fix it by adding the following line:

grunt.log.writeln('POSTRUN'); +this.requires(taskName + ':' + targetName);

in the newer-postrun task which according to grunt's documentation does what it should - even if it gets fired it will fail if jshint task failed. I checked, and with this line, the problem doesn't occur.