Running npm scripts parallelly utilizing full processor capacity

Viewed 790

I am running 7 npm commands parallelly using npm-run-all.

Running each command individually takes around 3 minutes. However, when I am running all the commands parallelly, it is taking 8 minutes and some times more than that.

How to execute these npm scripts parallelly utilizing all the processor cores?

I tried using concurrently as well. Also, I am thinking of running a shell script. However, this has to work in windows also.

2 Answers

If you want to run multiple npm commands in parallel you can use npm-run-all. It installs into your project and is available after your dependencies have been restored (unless of course, you install it globally).

If you want to run a command against multiple files in parallel you can use glob-exec. You supply it with a glob pattern to match one or more files and glob-exec will execute the command against each file.

Both packages have the option to run in parallel or in sequence. I've used the latter to shave multiple minutes off of my build times

Related