
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
grunt-surveil
Advanced tools
Watch files for changes, with granular control on the files and tasks it executes
This grunt task enables you to trigger tasks whenever files are added, changed, or removed. It's very much like grunt-contrib-watch but with a few different design choices:
grunt-surveil
to skip a task at runtime depending on which file changed.If you watch a lot of files/directories, triggering tasks can be a bit pain when using most other watchers. Re-watching thousands of nodes takes a while, even on an SSD.
This also causes responsiveness of the watch task to go down noticeably (if files are changed during triggered tasks, you won't retroactively get these file changes after the tasks are done, and have to "touch" the files once more to trigger the watch again.)
This is part of what grunt-surveil
has been designed to mitigate.
npm install --save-dev grunt-surveil
Then edit your Gruntfile.js
with the configuration (see below) and load the task with grunt.loadNpmTasks("grunt-surveil")
.
Like grunt-contrib-watch
, grunt-surveil
is a single-target grunt task that uses multi-task configuration.
delay: 100
The number of milliseconds to delay executing tasks when files change. This can be good to adjust if you want to do more "bulk runs."
emitOnAllTargets: false
Whether to trigger all targets when files change. The default behavior of gaze is to emit file changes to all watch instances. By default in grunt-surveil
, this behavior is disabled to provide more granular execution of tasks but might not play ball with every task out there.
rewriteThreshold: 100
The number of milliseconds that files are ignored after tasks has been run. It is only used when a task has the rewritesWatchedFiles
flag enabled.
src: "<%= foo.bar %>/**/baz/*.js"
The source files to watch on. Can be any pattern that is supported by grunt.
tasks: ["foo", "bar:baz"]
The list of grunt tasks to execute when src
files change. The tasks will be executed in order.
prepare: function(changedFiles, task)
This callback gets invoked once for every task in the task array. If you decide that the current task doesn't need to be executed, returning false
from this callback will make grunt-surveil
to ignore that task.
rewritesWatchedFiles: false
This flag can be used on targets that you know will overwrite watched files. Due to re-using file watchers under task executions, these watches will trigger changes on files that the executed tasks changes. This prohibits grunt-surveil
from triggering during that time.
A typical configuration might look something like this:
grunt.initConfig( {
surveil: {
javascript: {
src: ["gruntfile.js", "lib/**/*.js"],
prepare: function( changedFiles, task ) {
grunt.config( "eslint.partial", changedFiles );
},
tasks: ["eslint:partial"]
}
}
} );
The above configuration will only run the eslint:partial
task with the changed files, instead of running on potentially thousands of watched files.
Here's another example, using the rewritesWatchedFiles
flag. This flag is used to discard file changes while a file-writing task is being run, to work around triggering the task double or indefinitely:
grunt.initConfig( {
surveil: {
options: {
rewriteThreshold: 250
},
javascript: {
rewritesWatchedFiles: true,
src: ["gruntfile.js", "lib/**/*.js"],
prepare: function( changedFiles, task ) {
grunt.config( "esformatter.partial", changedFiles );
},
tasks: ["esformatter:partial"]
}
}
} );
This project uses MIT. See LICENSE
file for additional information.
FAQs
Watch files for changes, with granular control on the files and tasks it executes
The npm package grunt-surveil receives a total of 1 weekly downloads. As such, grunt-surveil popularity was classified as not popular.
We found that grunt-surveil demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.