@0x-lerna-fork/project 中文文档教程
@0x-lerna-fork/project
Lerna 项目配置
Configuration Resolution
Lerna 基于文件的配置位于lerna.json
或package.json
的lerna
属性中。 无论在哪里找到这个配置,都被认为是 lerna 管理的多包存储库的“根”。 最小可行配置只需要一个 version
属性; 以下示例是等效的:
{
"version": "1.2.3"
}
{
"name": "my-monorepo",
"version": "0.0.0-root",
"private": true,
"lerna": {
"version": "1.2.3"
}
}
此配置对象上的任何其他属性将用作 所有 lerna 子命令的 CLI 选项的默认值。 也就是说,CLI 选项总是 覆盖在配置文件中找到的值(CLI 应用程序的标准做法)。
Command-Specific Configuration
要将配置集中在特定的子命令上,请使用 command
子树。 command
的每个子属性对应一个lerna子命令(publish
, create
, run
, exec等)。
{
"version": "1.2.3",
"command": {
"publish": {
"loglevel": "verbose"
}
},
"loglevel": "success"
}
在上面的示例中,lerna publish
将作为传递了 --loglevel verbose
的行为。 所有其他子命令将收到等同于 --loglevel success
(安静得多)。
@0x-lerna-fork/project
Lerna project configuration
Configuration Resolution
Lerna's file-based configuration is located in lerna.json
or the lerna
property of package.json
. Wherever this configuration is found is considered the "root" of the lerna-managed multi-package repository. A minimum-viable configuration only needs a version
property; the following examples are equivalent:
{
"version": "1.2.3"
}
{
"name": "my-monorepo",
"version": "0.0.0-root",
"private": true,
"lerna": {
"version": "1.2.3"
}
}
Any other properties on this configuration object will be used as defaults for CLI options of all lerna subcommands. That is to say, CLI options always override values found in configuration files (a standard practice for CLI applications).
Command-Specific Configuration
To focus configuration on a particular subcommand, use the command
subtree. Each subproperty of command
corresponds to a lerna subcommand (publish
, create
, run
, exec
, etc).
{
"version": "1.2.3",
"command": {
"publish": {
"loglevel": "verbose"
}
},
"loglevel": "success"
}
In the example above, lerna publish
will act as if --loglevel verbose
was passed. All other subcommands will receive the equivalent of --loglevel success
(much much quieter).