如何顺序运行lerna?

目标

希望知道如何使用 Lerna 以顺序模式运行包。

方法

这是带有 packages 声明的 learn.json

{
  "npmClient": "npm",
  "npmClientArgs": [
    "--registry",
    "https://npm.foo.com"
  ],
  "command": {
    "publish": {
      "ignoreChanges": [
        "**/.spec.*",
        "**/*.md",
        "**/tsconfig*.*"
      ],
      "registry": "https://npm.foo.com"
    }
  },
  "packages": [
    "packages/commands/*",
    "packages/specs/*",
    "packages/support/*",
    "packages/tasks/*",
    "packages/tools/*"
  ],
  "version": "independent"
}

package.json 中,以下是其发出 lerna run 请求的脚本示例:

    "audit": "lerna run audit --stream",
    "build": "lerna run build --stream",
    "clean": "lerna clean",
    "postinstall": "lerna bootstrap",
    "upgrade": "lerna run npm:upgrade --stream",
    "test": "lerna run coverage --stream"

目标是修改 package.json 脚本“test”,以便 lerna 在每个包上按顺序运行每个包的测试,而不是并行运行**。

如果可能,请按特定顺序运行测试。

这个 "test" 脚本应该如何修改?:

    "test": "lerna run test --stream"

lerna run 确实有一个命令选项 --parallel ,但是,我发现如果没有设置此选项,执行是异步发生的(并行):

--parallel          Run script with unlimited concurrency, streaming prefixed output.
stack overflow How to run lerna sequentially?
原文答案

答案:

作者头像

lerna run --concurrency 1

Global Options:
      --concurrency    How many processes to use when lerna parallelizes tasks.      [number] [default: 10]