Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Set of methods to synchronize asynchronous operations.
npm install cjs-runner
Add to the scope:
var Runner = require('cjs-runner'),
runner = new Runner();
Create a simple sync task:
runner.task('lint', function () {
// some actions
});
Create a simple async task:
runner.task('build', function ( done ) {
someAsyncCall(function () {
// handle call result
done();
});
});
Create a task with serial subtasks:
runner.task('serve', runner.serial('lint', 'build'));
Create a task with parallel subtasks:
runner.task('build', runner.parallel('jade:build', 'sass:build'));
It's possible to use either anonymous or named functions as well:
runner.task('build', runner.parallel('jade:build', 'sass:build', function lessBuild ( done ) {
// function name "lessBuild" is used as task name
// otherwise <noname> is printed
done();
}));
Batch tasks creation:
Object.assign(runner.tasks,
{
taskName1: taskFunction1,
taskName2: taskFunction2
},
{
taskName3: taskFunction3,
taskName4: taskFunction4
}
);
Execute a task by name:
runner.run('lint');
Execute a task and handle the result:
runner.run('lint', function ( error ) {
if ( error ) {
console.log('the task has failed!');
}
});
Execute a task as a named or anonymous function:
runner.run(function ( done ) {
done();
});
Execute task series:
runner.run(runner.parallel('lint', 'build'));
Execute task chain:
// no result check
runner.start();
// hook on task completion
runner.start(function () {
console.log('finished');
});
// hook on task completion
runner.start(function ( error ) {
if ( error ) {
console.log('failed!');
}
});
Hook on task start/stop events:
runner.addListener('start', function ( event ) {
// {id: 'lint'}
console.log(event);
});
runner.addListener('finish', function ( event ) {
// {id: 'lint', time: 1}
console.log(event);
});
If you have any problems or suggestions please open an issue according to the contribution rules.
cjs-runner
is released under the MIT License.
FAQs
Simple task runner.
We found that cjs-runner 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
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.