
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-delegate
Advanced tools
Run a task (and an optional target) while using an arbitrary set of files to run checks against.
Run a task (and an optional target) while using an arbitrary set of files to run checks against.
If you haven't used Grunt before, be sure to check out the Getting started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
$ npm i -D grunt-delegate
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks( 'grunt-delegate' );
There are no options for the delegate
multi task itself.
Each target configuration can have an optional task
property that holds the name of another task.
If a task is specified, Grunt tries to run it (see ES6 example below).
Otherwise, Grunt tries to run a task with the name of the current target (see SASS example below).
Run this task with the $ grunt delegate
command.
Task targets and files may be specified according to the Grunt Configuring tasks guide.
The primary goal of this task is to specify a set of files (e.g., by defining a src
property) that you can use in the context of another task.
This can be achieved by not running the delegate
task directly, but indirectly via another task.
Not yet perfectly clear? Let's see some real world examples then...
.scss
files if any of them changed since the last runIn this example, running $ grunt changed:delegate:sass
will run the sass
task if any .scss
file changed since the last run.
You cannot just run $ grunt changed:sass
, because the files specified in the sass
task are the root files only.
Thus, grunt-changed
is unaware of changed partials or modules.
By having grunt-changed
check the files provided by the delegate
configuration, however, any changed .scss
file (compare resources/scss/**/*.scss
with resources/scss/*.scss
) will cause the sass
task to get run.
grunt.initConfig( {
delegate: {
sass: {
src: [ 'resources/scss/**/*.scss' ]
}
},
sass: {
all: {
expand: true,
cwd: 'resources/scss/',
src: [ '*.scss' ],
dest: 'assets/css/',
ext: '.css'
}
}
} );
.js
files if any of them is newer than the time of the last runIn this example, running $ grunt newer:delegate:transpile
will run the browserify
task with the admin
target (see the task
property of the according delegate
configuration) if any .js
file is newer than the time of the last run.
You cannot just run $ grunt newer:browserify:admin
, because the file specified in the browserify
task is the main file only.
Thus, grunt-newer
is unaware of newer modules or helper files.
By having grunt-newer
check the files provided by the delegate
configuration, however, any newer .js
file (compare resources/js/**/*.js
with resources/js/admin.js
) will cause the browserify
task with the admin
target to get run.
grunt.initConfig( {
delegate: {
transpile: {
src: [ 'resources/js/**/*.js' ],
task: 'browserify:admin'
}
},
browserify: {
admin: {
options: {
transform: [
[ 'babelify' ]
]
},
src: [ 'resources/js/admin.js' ],
dest: 'assets/js/admin.js'
},
vendor: {
options: {
require: [ 'jquery' ]
},
src: [],
dest: 'public/vendor.js'
},
}
} );
.php
source files if any of them or one of the tests is newer than the time of the last runIn this example, running $ grunt newer:delegate:phpunit
will run the shell
task with the phpunit
target (see the task
property of the according delegate
configuration) if any .php
source files or tests is newer than the time of the last run.
You cannot just run $ grunt newer:shell:phpunit
, because in the shell
task are no files specified.
By having grunt-newer
check the files provided by the delegate
configuration, however, any newer .php
source file or test will cause the shell
task with the phpunit
target to get run.
grunt.initConfig( {
delegate: {
phpunit: {
src: [ 'src/**/*.php', 'tests/**/*.php' ],
task: 'shell:phpunit'
}
},
shell: {
phpunit: {
command: 'phpunit'
}
},
} );
In this example, running $ grunt changed:delegate:scripts
will run the scripts
alias task if any .js
source files changed since the last run.
You cannot just run $ grunt changed:scripts
, because in the scripts
task are no files specified.
By having grunt-changed
check the files provided by the delegate
configuration, however, any changed .js
source file will cause the scripts
alias task to get run.
grunt.initConfig( {
delegate: {
scripts: {
src: [ 'resources/js/**/*.js' ],
task: 'scripts'
}
},
// Other task configurations here...
} );
grunt.registerTask( 'scripts', [
'eslint:src',
'shell:tape',
'browserify',
'jsvalidate:dest',
'lineending:scripts',
'uglify'
] );
This plugin is licensed under the MIT license.
See CHANGELOG.md.
Task submitted by Thorsten Frommen.
1.0.0
FAQs
Run a task (and an optional target) while using an arbitrary set of files to run checks against.
The npm package grunt-delegate receives a total of 2 weekly downloads. As such, grunt-delegate popularity was classified as not popular.
We found that grunt-delegate 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.