diff --git a/commands/add/README.md b/commands/add/README.md index 55b6c95260..756eabf524 100644 --- a/commands/add/README.md +++ b/commands/add/README.md @@ -21,7 +21,7 @@ If no `version` specifier is provided, it defaults to the `latest` dist-tag, jus ## Options -`lerna add` respects the `--ignore`, `--scope`, and `--include-dependencies` flags (see [Filter Flags](https://www.npmjs.com/package/@lerna/filter-options)). +`lerna add` accepts all [filter flags](https://www.npmjs.com/package/@lerna/filter-options). ### `--dev` diff --git a/commands/bootstrap/README.md b/commands/bootstrap/README.md index 6063de9ec4..159a8784b6 100644 --- a/commands/bootstrap/README.md +++ b/commands/bootstrap/README.md @@ -20,7 +20,7 @@ When run, this command will: 3. `npm run prepublish` in all bootstrapped packages (unless `--ignore-prepublish` is passed). 4. `npm run prepare` in all bootstrapped packages. -`lerna bootstrap` respects the `--ignore`, `--scope`, and `--include-dependencies` flags (see [Filter Flags](https://www.npmjs.com/package/@lerna/filter-options)). +`lerna bootstrap` accepts all [filter flags](https://www.npmjs.com/package/@lerna/filter-options). Pass extra arguments to npm client by placing them after `--`: diff --git a/commands/clean/README.md b/commands/clean/README.md index 53afd58894..bd4fa5d1fa 100644 --- a/commands/clean/README.md +++ b/commands/clean/README.md @@ -12,6 +12,7 @@ $ lerna clean Remove the `node_modules` directory from all packages. -`lerna clean` respects the `--ignore`, `--scope`, and `--yes` flags (see [Filter Flags](https://www.npmjs.com/package/@lerna/filter-options)). +`lerna clean` accepts all [filter flags](https://www.npmjs.com/package/@lerna/filter-options), as well as `--yes`. + > `lerna clean` does not remove modules from the root `node_modules` directory, even if you have the `--hoist` option enabled. diff --git a/commands/exec/README.md b/commands/exec/README.md index f5d8f2adf7..a6184b52d1 100644 --- a/commands/exec/README.md +++ b/commands/exec/README.md @@ -29,7 +29,7 @@ $ lerna exec -- node \$LERNA_ROOT_PATH/scripts/some-script.js ## Options -`lerna exec` respects the `--concurrency`, `--scope`, and `--ignore` flags (see [Filter Flags](https://www.npmjs.com/package/@lerna/filter-options)). +`lerna exec` accepts all [filter flags](https://www.npmjs.com/package/@lerna/filter-options). ```sh $ lerna exec --scope my-component -- ls -la diff --git a/commands/exec/__tests__/exec-command.test.js b/commands/exec/__tests__/exec-command.test.js index 458f874110..8914a4950b 100644 --- a/commands/exec/__tests__/exec-command.test.js +++ b/commands/exec/__tests__/exec-command.test.js @@ -181,6 +181,19 @@ describe("ExecCommand", () => { "packages/package-2 ls (prefix: false)", ]); }); + + it("does not explode with filter flags", async () => { + await lernaExec(testDir)( + "ls", + "--no-private", + "--since", + "--include-merged-tags", + "--exclude-dependents", + "--include-dependencies" + ); + + expect(calledInPackages()).toEqual(["package-1", "package-2"]); + }); }); describe("with --no-sort", () => { diff --git a/commands/run/README.md b/commands/run/README.md index ff22360549..a7048c577d 100644 --- a/commands/run/README.md +++ b/commands/run/README.md @@ -19,7 +19,7 @@ Run an [npm script](https://docs.npmjs.com/misc/scripts) in each package that co ## Options -`lerna run` respects the `--concurrency`, `--scope`, and `--ignore` flags (see [Filter Flags](https://www.npmjs.com/package/@lerna/filter-options)). +`lerna run` accepts all [filter flags](https://www.npmjs.com/package/@lerna/filter-options). ```sh $ lerna run --scope my-component test diff --git a/core/filter-options/README.md b/core/filter-options/README.md index 163fc7c80d..d40b2e00ad 100644 --- a/core/filter-options/README.md +++ b/core/filter-options/README.md @@ -84,3 +84,11 @@ $ lerna bootstrap --scope "package-*" --ignore "package-util-*" --include-depend # all packages matching "package-util-*" will be ignored unless they are # depended upon by a package whose name matches "package-*" ``` + +### `--include-merged-tags` + +```sh +$ lerna exec --since --include-merged-tags -- ls -la +``` + +Include tags from merged branches when running a command with `--since`. This is only useful if you do a lot of publishing from feature branches, which is not generally recommended. diff --git a/core/filter-options/index.js b/core/filter-options/index.js index 658f974802..705fe6976e 100644 --- a/core/filter-options/index.js +++ b/core/filter-options/index.js @@ -59,6 +59,10 @@ function filterOptions(yargs) { `, type: "boolean", }, + "include-merged-tags": { + describe: "Include tags from merged branches when running a command with --since.", + type: "boolean", + }, "continue-if-no-match": { describe: "Don't fail if no package is matched", hidden: true, diff --git a/core/filter-options/lib/get-filtered-packages.js b/core/filter-options/lib/get-filtered-packages.js index de6dfba54d..be0d6882b6 100644 --- a/core/filter-options/lib/get-filtered-packages.js +++ b/core/filter-options/lib/get-filtered-packages.js @@ -18,6 +18,7 @@ const FilterConfig = figgyPudding({ includeDependencies: {}, includeFilteredDependents: "includeDependents", includeFilteredDependencies: "includeDependencies", + includeMergedTags: {}, log: { default: npmlog }, }); @@ -51,6 +52,10 @@ function getFilteredPackages(packageGraph, execOpts, opts) { options.log.notice("filter", "excluding dependents"); } + if (options.includeMergedTags) { + options.log.notice("filter", "including merged tags"); + } + chain = chain.then(filteredPackages => Promise.resolve(collectUpdates(filteredPackages, packageGraph, execOpts, opts)).then(updates => { const updated = new Set(updates.map(({ pkg }) => pkg.name));