You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using grunt-jscs or grunt-contrib-jshint, editing your linting rules does not cause your entire source tree to be re-linted unless you run grunt clean or manually remove the .cache/ directory. This can lead to mistakenly thinking your source tree is compliant with the linting changes until you run a clean build at a later time.
It would be nice if there was an option to grunt-newer to tell it to invalidate the entire .cache/ directory if Gruntfile.js has been modified since the last run. Finding a solution that also works with load-grunt-config could be tricky.
If you're not using load-grunt-config, a workaround is (Unix only):
/** Clear grunt-newer cache when gruntfile.js changes */
function maybeClearNewerCache(grunt) {
var lastRunTime;
try {
lastRunTime = fs.statSync('.grunt-record').mtime;
} catch (e) {
lastRunTime = new Date(0);
}
if (fs.statSync(__filename).mtime > lastRunTime) {
var cmd = { cmd: 'rm', args: ['-rf', './node_modules/grunt-newer/.cache'] };
grunt.util.spawn(cmd, function (error, result, code) {
if (error) { grunt.fatal(error); }
});
}
}
maybeClearNewerCache(grunt);
grunt.registerTask('record', 'Record the build time', function () {
grunt.file.write('.grunt-record', 'blah');
});
grunt.registerTask('default', [
... // other tasks here
'record'
]);
The text was updated successfully, but these errors were encountered:
It's not only Gruntfile.js
There are plenty options:
.eslintrc
.jshintrc
and others.
So the best if there would be an options to define that for particular task on changing some files cache must be cleaned.
E.g.:
When using
grunt-jscs
orgrunt-contrib-jshint
, editing your linting rules does not cause your entire source tree to be re-linted unless you rungrunt clean
or manually remove the.cache/
directory. This can lead to mistakenly thinking your source tree is compliant with the linting changes until you run a clean build at a later time.It would be nice if there was an option to
grunt-newer
to tell it to invalidate the entire.cache/
directory ifGruntfile.js
has been modified since the last run. Finding a solution that also works withload-grunt-config
could be tricky.If you're not using
load-grunt-config
, a workaround is (Unix only):The text was updated successfully, but these errors were encountered: