@gnoesiboe/run-concurrently

中文文档
3.0.3发布于 2023/05/11ISCCommonJS近 30 天下载 4487

Command line tool to use 'concurrently' with a JSON configuration, to make it more readable and easier to manage.

原始使用文档
文档目录7 节
  1. Installation
  2. Usage
  3. Configuration
  4. CLI command usage
  5. Running the command
  6. Development
  7. Running tests

@gnoesiboe/run-concurrently

Node cli task that uses concurrently combined with a JSON configuration in package.json or separate file, to make concurrent tasks better readable and easier to configure. It for instance can be used to build a project in one command, when it consists of separate individual applications. Within our organisation we use it for starting and maintaining several development servers with one command.

alt text;

Installation

npm install --save-dev @gnoesiboe/run-concurrently

Usage

  1. Add your task configuration to your application's package.json or separate json file.
  2. Use the cli command to execute the tasks concurrently
  3. Setup shortcuts in the root of your application for easier execution (for instance scripts in package.json or make)

Configuration

Can be placed in package.json, located in the location that this task is run from:

Format:

{
    ...,
    "concurrentTasks": {
        "<task_name>": {
            "subTasks": [
                {
                    "workingDirectory": "<directory_to_execute_code_in>",
                    "command": "<command_to_execute_in_working_directory>",
                    "name": "<prefix_that_is_used_to_distinguish_seperate_tasks_output>"
                },
                ...
            ]
        }
    }
}

Example, added to package.json:

{
    ...,
    "concurrentTasks": {
        "build": {
            "subTasks": [
                {
                    "workingDirectory": "./assets/a",
                    "command": "npm run build",
                    "name": "website"
                },
                {
                    "workingDirectory": "./assets/b",
                    "command": "npm run build",
                    "name": "admin"
                },
                {
                    "workingDirectory": "./assets/c",
                    "command": "npm run build",
                    "name": "frontend"
                }
            ],
            "options": {
                "prefixLength": 20
            }
        },
        "build:watch": {
            "subTasks": [...]
        }
    }
}

You can also place the configuration outside the package.json and into a separate JSON file. For this task to find it, you have to use the --config option to supply the server path to it. See below for more information.

CLI command usage

Arguments

namedescriptiontyperequireddefault value
taskThe task to execute from the configurationstringfalse'build'

Options

namedescriptiontyperequireddefault value
--config or -cPath to an alternate configuration file that you want to usestringfalsefallback on package.json in current working directory
--help or -hPrints information about how to use this cli commandna.falsena.
--verbose or -vIf flagged with verbose, extra debug output is displayedna.falsena.

Running the command

With configuration in package.json:

./node_modules/.bin/run-concurrently <command> --verbose

With separate configuration file:

./node_modules/.bin/run-concurrently <command> --config=/path/to/config.json --verbose

Often it easier to alias it in a NPM script, like:

// package.json

{
    "scripts": {
        "<command>": "run-concurrently <command>"
    }
}

Development

Install dependencies:

npm install

Running tests

Run tests by executing:

npm run test

Or in watch mode:

npm run test:watch

版本与发布记录

@gnoesiboe/run-concurrently 共发布 19 个版本,首次发布于 2019/04/10;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.0.3latest2023/05/113 年前
3.0.22023/05/113 年前
3.0.12023/05/093 年前
3.0.02023/05/093 年前
2.0.02022/02/244 年前
1.0.12021/10/285 年前

关于 @gnoesiboe/run-concurrently 的常见问题

@gnoesiboe/run-concurrently 是什么?

Command line tool to use 'concurrently' with a JSON configuration, to make it more readable and easier to manage.

如何安装 @gnoesiboe/run-concurrently?

在项目目录运行 npm install @gnoesiboe/run-concurrently,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 run-concurrently,可以用 npx run-concurrently 直接运行。

@gnoesiboe/run-concurrently 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gnoesiboe__run-concurrently 是否存在。

@gnoesiboe/run-concurrently 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@gnoesiboe/run-concurrently 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^16.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gnoesiboe/run-concurrently 可以商用吗?

@gnoesiboe/run-concurrently 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gnoesiboe/run-concurrently 的下载量有多少?

根据 npm 官方下载统计,@gnoesiboe/run-concurrently 在 2026/10/17 – 2026/11/15 这 30 天内被下载 4,487 次,日均约 150 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gnoesiboe/run-concurrently 还在维护吗?

最新版本 3.0.3 发布于 2023/05/11(3 年前);至今共发布 19 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/04/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。