
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
gulp-errorable
Advanced tools
A module which wraps common gulp functions and functionality in order to allow execution of a specified function if a task encounters an error.
A module providing a custom registry which decorates gulp tasks, to provide the ability to execute error logging functionality in the event that an error occurs. I made this because I wanted to have my verification script, which is basically a local version of my CI script, send me slack messages. However, the time involved in sending the slack message, over the network, meant that gulp terminated the slack messaging function before it could send.
This decorator-based approach allows gulp to wait until a long-running function is finished executing before it terminates. In essence, it allows me to send my slack messages. However, it can really do anything that is needed if an error is found.
Import the library and tell gulp to use its registry.
The function to be executed if an error is found, will be awaited, thus it
should return a Promise
.
import { ErrorableRegistry } from 'gulp-errorable';
const myErrorLoggingFunction = () =>
new Promise((resolve, _reject) => {
console.warn('we found an error!');
resolve();
});
gulp.registry(new ErrorableRegistry(myErrorLoggingFunction));
Task example:
const lint = seriesPromise({
name: 'lint',
tasks: [_lintTs, _checkTypes],
});
const verify = seriesPromise({
name: 'verify',
tasks: [
_registerSlackNotify,
_gitStatusHumanReview,
lint,
test,
_slackNotify,
],
});
export { lint, test };
This is essentially the same way that gulp is normally used.
ErrorableRegistry(errorHandlingFunction: ErrorHandlingFunction)
// where the type of ErrorHandlingFunction is:
type ErrorHandlingFunction = () => Promise<any>;
This is the main custom gulp registry which allows you to provide a function to decorate your tasks, in other words it allows you to do something specific if an error is found in a task. Essentially, you can use this function to do something like make a network request or write to a log file or whatever.
seriesPromise(options:{
name?: string;
tasks: Task[];
})
Will create a task that wraps series it is essentially equivalent to something like:
const exampleTask = series(task1, task1);
The name is optional, but if it is not provided it will be <anonymous>
, see
Caveats.
parallelPromise(options:{
name?: string;
tasks: Task[];
})
Will create a task that wraps parallel it is essentially equivalent to something like:
const exampleTask = parallel(task1, task1);
The name is optional, but if it is not provided it will be <anonymous>
, see
Caveats.
All tasks must use the gulp Promise-based completion method.
This is just a simplifying assumption made, due to the limited amount of safe information
given to the module by gulp. To help facilitate this the gulp-errorable
provides
several wrappers around series
and parallel
. These essentially "promisify"
each of these functions respectively.
Due to this, the names of the tasks using these will not be very friendly,
specifically: they will be <anonymous>
. However, a name can be provided
which fixes this problem, this is optional, and the <anonymous>
name can
be used if desired, for some reason.
MIT Copyright (c) David Piper
FAQs
A module which wraps common gulp functions and functionality in order to allow execution of a specified function if a task encounters an error.
We found that gulp-errorable 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.