Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
concurrently
Advanced tools
The 'concurrently' npm package is a utility that allows you to run multiple commands concurrently. It is often used to run multiple processes during development, such as a server and a client application at the same time. It can handle the output of these processes, terminate them all together, and more.
Running multiple commands
This feature allows you to run multiple commands at the same time. Each command is quoted and separated by a space.
concurrently "command1 arg" "command2 arg"
Customizing the prefix for command output
This feature allows you to customize the prefix shown in the output for each command. In this example, 'API' and 'UI' are custom prefixes for the two npm scripts.
concurrently --names "API,UI" "npm:api" "npm:start"
Killing all commands when one of them exits
This feature ensures that if one command exits, all other commands are also terminated. This is useful for cleaning up processes if one fails.
concurrently --kill-others "command1" "command2"
Running commands sequentially
This feature allows you to run commands sequentially instead of concurrently. The --success option determines which command's exit code will be used as the exit code for concurrently.
concurrently "command1" "command2" --success first
A CLI tool to run multiple npm-scripts in parallel or sequential. It is similar to concurrently but specifically designed for npm scripts. It provides a simpler interface for running scripts in series or parallel.
PM2 is a production process manager for Node.js applications with a built-in load balancer. It is more feature-rich than concurrently, providing a daemon process that helps keep applications alive forever, facilitates common system admin tasks, and can be used in production environments.
Foreman is a manager for Procfile-based applications. Its focus is on easing the development of applications by allowing you to run multiple processes with a single command. It is not limited to Node.js and can be used with any language or markup.
Version: 0.0.2 (previous stable)
Run multiple commands concurrently. Like command1 & command2
but better.
Usage: concurrent [options] <command ...>
Options:
-h, --help output usage information
-V, --version output the version number
-k, --kill-others kill other processes if one exits or dies
--no-color disable colors from logging
-p, --prefix [prefix] prefix used in logging for each process. Possible values: pid, none, command
Examples:
- Kill other processes if one exits or dies
$ concurrent --kill-others "grunt watch" "http-server"
For more details, visit https://github.com/kimmobrunfeldt/concurrently
Run less watch task and watchify with `--kill-others`` option. If one of the processes dies, another is killed too.
concurrent -k "lessc main.less bundle.css" "watchify main.js -o bundle.js"
The tool is written in nodejs, but you can use it to run any commands.
npm install -g concurrently
I like task automation with npm
but the suggested way to run multiple commands concurrently is
npm run watch-js & npm run watch-css
. That's fine but it's hard to keep
on track of different outputs. Also if one process fails, others still keep running
and you won't even notice the difference.
Another option would be to just run all commands in separate terminals. No thanks.
FAQs
Run commands concurrently
The npm package concurrently receives a total of 4,816,031 weekly downloads. As such, concurrently popularity was classified as popular.
We found that concurrently demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.