@0x-lerna-fork/filter-options 中文文档教程

发布于 5年前 浏览 25 项目主页 更新于 3年前

@0x-lerna-fork/filter-options

需要过滤的 lerna 子命令的选项

安装 lerna 以访问 lerna CLI。

Options

--scope <glob>

仅包含名称与给定 glob 匹配的包。

$ lerna exec --scope my-component -- ls -la
$ lerna run --scope toolbar-* test
$ lerna run --scope package-1 --scope *-2 lint

注意:对于某些 glob,可能需要引用选项参数以避免过早的 shell 扩展。

--ignore <glob>

排除名称与给定 glob 匹配的包。

$ lerna exec --ignore package-{1,2,5}  -- ls -la
$ lerna run --ignore package-1  test
$ lerna run --ignore package-@(1|2) --ignore package-3 lint

可以在此处。

--no-private

排除私人包裹。 默认包含它们。

--since [ref]

仅包含自指定的 ref 以来已更新的包。 如果未传递 ref,则默认为最新标签。

# List the contents of packages that have changed since the latest tag
$ lerna exec --since -- ls -la

# Run the tests for all packages that have changed since `master`
$ lerna run test --since master

# List all packages that have changed since `some-branch`
$ lerna ls --since some-branch

这在 CI 中使用时特别有用,如果您可以获得 PR 将进入的目标分支,因为您可以将其用作 ref -- 因为 选项。 这对于进入主分支和功能分支的 PR 非常有效。

--include-filtered-dependents

在运行命令时包括所有可传递的依赖项,而不考虑 --scope--ignore,或 --since

--include-filtered-dependencies

无论 --scope--ignore--since,在运行命令时包括所有传递依赖项。

与任何接受 --scope 的命令结合使用(bootstrapcleanlsrun ,<代码>执行)。 确保任何作用域包的所有依赖项(和开发依赖项)(通过 --scope--ignore)也被操作。

注意:这将覆盖 --scope--ignore 标志。

即,如果一个被 --ignore 标志匹配的包被另一个正在引导的包所依赖,它仍然会被引导。

这对于您想要“设置”依赖于正在设置的其他包的单个包的情况很有用。

$ lerna bootstrap --scope my-component --include-filtered-dependencies
# my-component and all of its dependencies will be bootstrapped
$ lerna bootstrap --scope "package-*" --ignore "package-util-*" --include-filtered-dependencies
# all packages matching "package-util-*" will be ignored unless they are
# depended upon by a package whose name matches "package-*"

@0x-lerna-fork/filter-options

Options for lerna sub-commands that need filtering

Install lerna for access to the lerna CLI.

Options

--scope <glob>

Include only packages with names matching the given glob.

$ lerna exec --scope my-component -- ls -la
$ lerna run --scope toolbar-* test
$ lerna run --scope package-1 --scope *-2 lint

Note: For certain globs, it may be necessary to quote the option argument to avoid premature shell expansion.

--ignore <glob>

Exclude packages with names matching the given glob.

$ lerna exec --ignore package-{1,2,5}  -- ls -la
$ lerna run --ignore package-1  test
$ lerna run --ignore package-@(1|2) --ignore package-3 lint

More examples of filtering can be found here.

--no-private

Exclude private packages. They are included by default.

--since [ref]

Only include packages that have been updated since the specified ref. If no ref is passed, it defaults to the most-recent tag.

# List the contents of packages that have changed since the latest tag
$ lerna exec --since -- ls -la

# Run the tests for all packages that have changed since `master`
$ lerna run test --since master

# List all packages that have changed since `some-branch`
$ lerna ls --since some-branch

This can be particularly useful when used in CI, if you can obtain the target branch a PR will be going into, because you can use that as the ref to the --since option. This works well for PRs going into master as well as feature branches.

--include-filtered-dependents

Include all transitive dependents when running a command regardless of --scope, --ignore, or --since.

--include-filtered-dependencies

Include all transitive dependencies when running a command regardless of --scope, --ignore, or --since.

Used in combination with any command that accepts --scope (bootstrap, clean, ls, run, exec). Ensures that all dependencies (and dev dependencies) of any scoped packages (either through --scope or --ignore) are operated on as well.

Note: This will override the --scope and --ignore flags.

i.e. A package matched by the --ignore flag will still be bootstrapped if it is depended on by another package that is being bootstrapped.

This is useful for situations where you want to "set up" a single package that relies on other packages being set up.

$ lerna bootstrap --scope my-component --include-filtered-dependencies
# my-component and all of its dependencies will be bootstrapped
$ lerna bootstrap --scope "package-*" --ignore "package-util-*" --include-filtered-dependencies
# all packages matching "package-util-*" will be ignored unless they are
# depended upon by a package whose name matches "package-*"
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文