npm-run-all vs concurrently vs np vs npm-run
NPM Task Management
npm-run-allconcurrentlynpnpm-runSimilar Packages:

NPM Task Management

NPM Task Management packages are tools that help developers run multiple scripts or commands concurrently, sequentially, or manage their execution more efficiently within a Node.js environment. These packages enhance the capabilities of npm (Node Package Manager) scripts, allowing for better automation, parallel processing, and streamlined workflows in JavaScript projects. They are particularly useful in build processes, testing, and deployment tasks, where managing multiple commands is common.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
npm-run-all1,926,1475,845-1137 years agoMIT
concurrently07,715422 kB657 months agoMIT
np07,685102 kB22 months agoMIT
npm-run0187-78 years agoMIT

Feature Comparison: npm-run-all vs concurrently vs np vs npm-run

Running Scripts

  • npm-run-all:

    npm-run-all can run multiple npm scripts either in parallel or sequentially, giving you more control over how scripts are executed. It’s more versatile than the others for handling multiple scripts.

  • concurrently:

    concurrently allows you to run multiple commands simultaneously, displaying their output in the terminal. It handles command conflicts and provides options to customize the output format.

  • np:

    np focuses on a single task: publishing npm packages. It guides you through the publishing process, ensuring best practices are followed, but it doesn’t run multiple scripts.

  • npm-run:

    npm-run is designed to run a single npm script or command at a time. It doesn’t support parallel or sequential execution of multiple scripts.

Output Management

  • npm-run-all:

    npm-run-all displays output from all scripts it runs, but it doesn’t provide real-time output for parallel scripts by default. You can configure it to improve output clarity.

  • concurrently:

    concurrently provides real-time output from all running commands, making it easy to monitor their progress. You can customize how the output is displayed to differentiate between commands.

  • np:

    np provides output related to the publishing process, including version changes, changelog updates, and any errors that occur during publishing. It’s focused and informative but not real-time.

  • npm-run:

    npm-run simply outputs the result of the npm script it runs. It doesn’t provide any special output management or formatting.

Error Handling

  • npm-run-all:

    npm-run-all can be configured to stop on errors, and it provides clear error messages for failed scripts. It’s more flexible than the others in handling errors.

  • concurrently:

    concurrently handles errors from all running commands and can be configured to stop all commands if one fails. It provides clear error messages to help diagnose issues.

  • np:

    np has robust error handling for the publishing process, including checks for git status, versioning, and npm login. It prevents publishing if there are issues, ensuring a smooth process.

  • npm-run:

    npm-run relies on the error handling of the npm scripts it runs. It doesn’t provide any additional error handling or reporting.

Customization

  • npm-run-all:

    npm-run-all is highly customizable, allowing you to define how scripts are run (parallel vs. sequential), set prefixes, and configure error handling.

  • concurrently:

    concurrently allows for some customization, such as changing the output style, setting command prefixes, and configuring how it handles errors and exits.

  • np:

    np offers limited customization, mainly around the publishing process. You can configure prompts, git settings, and npm settings, but it’s mostly opinionated to ensure best practices.

  • npm-run:

    npm-run is a simple tool with minimal customization options. It runs scripts as defined in the package.json file without any additional features.

Ease of Use: Code Examples

  • npm-run-all:

    Run scripts in parallel with npm-run-all

    npx npm-run-all --parallel build test
    
  • concurrently:

    Run multiple commands with concurrently

    npx concurrently "npm run build" "npm run serve"
    
  • np:

    Publish a package with np

    npx np
    
  • npm-run:

    Run a single npm script with npm-run

    const npmRun = require('npm-run');
    npmRun.exec('npm run build');
    

How to Choose: npm-run-all vs concurrently vs np vs npm-run

  • npm-run-all:

    Choose npm-run-all if you need to run multiple npm scripts either in parallel or sequentially with a simple command. It’s flexible and allows for better organization of complex build processes.

  • concurrently:

    Choose concurrently if you need to run multiple npm scripts or commands at the same time and want to see their output in real-time. It’s great for tasks like running a development server while compiling assets.

  • np:

    Choose np if you want a user-friendly tool for publishing npm packages with built-in features like version bumping, changelog generation, and automated git operations. It’s ideal for developers who want a streamlined publishing process.

  • npm-run:

    Choose npm-run if you need a simple way to run npm scripts programmatically from your Node.js code. It’s useful for creating custom task runners or scripts that need to execute existing npm commands.

README for npm-run-all

indexnpm-run-allrun-srun-pNode API

npm-run-all

npm version Downloads/month Build Status Build status Coverage Status Dependency Status

A CLI tool to run multiple npm-scripts in parallel or sequential.

⤴️ Motivation

  • Simplify. The official npm run-script command cannot run multiple scripts, so if we want to run multiple scripts, it's redundant a bit. Let's shorten it by glob-like patterns.
    Before: npm run clean && npm run build:css && npm run build:js && npm run build:html
    After: npm-run-all clean build:*
  • Cross platform. We sometimes use & to run multiple command in parallel, but cmd.exe (npm run-script uses it by default) does not support the &. Half of Node.js users are using it on Windows, so the use of & might block contributions. npm-run-all --parallel works well on Windows as well.

💿 Installation

$ npm install npm-run-all --save-dev
# or
$ yarn add npm-run-all --dev
  • It requires Node@>=4.

📖 Usage

CLI Commands

This npm-run-all package provides 3 CLI commands.

The main command is npm-run-all. We can make complex plans with npm-run-all command.

Both run-s and run-p are shorthand commands. run-s is for sequential, run-p is for parallel. We can make simple plans with those commands.

Yarn Compatibility

If a script is invoked with Yarn, npm-run-all will correctly use Yarn to execute the plan's child scripts.

Node API

This npm-run-all package provides Node API.

📰 Changelog

🍻 Contributing

Welcome♡

Bug Reports or Feature Requests

Please use GitHub Issues.

Correct Documents

Please use GitHub Pull Requests.

I'm not familiar with English, so I especially thank you for documents' corrections.

Implementing

Please use GitHub Pull Requests.

There are some npm-scripts to help developments.

  • npm test - Run tests and collect coverage.
  • npm run clean - Delete temporary files.
  • npm run lint - Run ESLint.
  • npm run watch - Run tests (not collect coverage) on every file change.