Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spawn-task-experiment-2

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spawn-task-experiment-2

Tests how fast it is to run gulp tasks in child processes

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Spawn task experiment 2

Tests how fast it is to run gulp tasks in child processes

This is a fork of Spawn task experiment to allow to pass some information into child process. I sent a pullRequest but never got an answer, so I'm posting this so I can use it in npm.

Run task in child process:

var makeItFaster = require('spawn-task-experiment').spawn;

gulp.task('whatever', makeItFaster(function() {
	var gulp = require('gulp');
	var sourcemaps = require('gulp-sourcemaps');
	var concat = require('gulp-concat');
	return gulp.src(['app/index.js', 'app/**/*.js'])
		.pipe(sourcemaps.init())
		.pipe(concat('all.js'))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('.build/scripts'));
}));

Run task in worker pool:

var makeItFaster = require('spawn-task-experiment').workerPool();

gulp.task('whatever', makeItFaster(function() {
	var gulp = require('gulp');
	var sourcemaps = require('gulp-sourcemaps');
	var concat = require('gulp-concat');
	return gulp.src(['app/index.js', 'app/**/*.js'])
		.pipe(sourcemaps.init())
		.pipe(concat('all.js'))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('.build/scripts'));
}));

Notes:

  • All wrapped functions need to be self-contained
  • Using worker pool prevents parent process exit, so it might be usable only when watch is running
  • Worker pool starts re-using child processes only after maxConcurrentWorkers limit has been reached (default is cpus().length)

Keywords

FAQs

Package last updated on 21 Feb 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc