Skip to main content

Lerna 6:过时的选项

¥Lerna 6: Obsolete Options

Nx 和 Lerna 在同一工作区中无缝协作。

¥Nx and Lerna work together seamlessly in the same workspace.

当 Lerna 使用 Nx 运行任务并检测到 Nx 目标配置时,Lerna 将在 lerna run 期间尊重此配置并将依赖检测委托给 Nx 任务运行程序。

¥When Lerna is running tasks with Nx and detects Nx target configuration, Lerna will respect this configuration during lerna run and delegate dependency detection to the Nx task runner.

Nx 将根据其创建的任务图确定适当的顺序和并发度来运行任务。欲了解更多信息,请参阅 Nx 心智模型:任务图

¥Nx will run tasks in an order and with a concurrency that it determines appropriate based on the task graph that it creates. For more information, see Nx Mental Model: The Task Graph.

此行为允许 Nx 以尽可能最有效的方式运行任务,但这也意味着 lerna run 的一些现有选项已过时。

¥**This behavior allows Nx to run tasks in the most efficient way possible, but it also means that some existing options for lerna run become obsolete. **


¥Obsolete Options


¥--sort and --no-sort

配置 Nx 目标时,Lerna 将始终根据其对项目和任务依赖的了解,按照其认为正确的顺序运行任务,因此 --sort--no-sort 无效。

¥When Nx targets are configured, Lerna will always run tasks in the order it deems is correct based on its knowledge of project and task dependencies, so --sort and --no-sort have no effect.


Lerna 将使用任务图来确定哪些任务可以并行运行并自动执行此操作,因此 --parallel 不起作用。

¥Lerna will use the task graph to determine which tasks can be run in parallel and do so automatically, so --parallel has no effect.


如果你想限制任务的并发数,你仍然可以使用 并发全局选项 来完成。

¥If you want to limit the concurrency of tasks, you can still use the concurrency global option to accomplish this.


Lerna 6 会在必要时自动首先运行依赖任务,因此 --include-dependencies 已过时。但是,该标志仍然可以用于包含不需要的任务(例如,运行所有依赖目的测试)。

¥Lerna 6 will automatically run dependent tasks first when necessary, so --include-dependencies is obsolete. However, the flag can still be used to include tasks that are not required (e.g., running the tests of all the dependent projects).


当与 Nx 一起使用时,--ignore 绝不会导致 lerna run 排除 任务图 认为需要的任何任务。

¥When used with Nx, --ignore will never cause lerna run to exclude any tasks that are deemed to be required task graph.



¥The effects on the options above will only apply if:

  1. nx.json 存在于定义了 targetDefaults 属性的根中。

    ¥nx.json exists in the root with the targetDefaults property defined.

  2. "nx" 属性可在目标包的 package.json 中找到。

    ¥The "nx" property is found in the package.json of a target package.

否则,它们的行为就像使用 Lerna 的旧任务运行程序一样(如果 useNxfalse)。

¥Otherwise, they will behave just as they would with Lerna's legacy task runner (if useNx is false).