@lerna/run
Advanced tools
Comparing version 3.0.0-beta.21 to 3.0.0-rc.0
@@ -6,2 +6,17 @@ # Change Log | ||
<a name="3.0.0-rc.0"></a> | ||
# [3.0.0-rc.0](https://github.com/lerna/lerna/compare/v3.0.0-beta.21...v3.0.0-rc.0) (2018-07-27) | ||
### Features | ||
* Add description from --help summary [skip ci] ([9b65d8e](https://github.com/lerna/lerna/commit/9b65d8e)) | ||
* **cli:** Upgrade to Yargs 12 ([7899ab8](https://github.com/lerna/lerna/commit/7899ab8)) | ||
* **command:** Remove .defaultOptions() from option resolution stack ([2b27a54](https://github.com/lerna/lerna/commit/2b27a54)) | ||
* Count packages affected in command summary logging ([5f5e585](https://github.com/lerna/lerna/commit/5f5e585)) | ||
<a name="3.0.0-beta.21"></a> | ||
@@ -8,0 +23,0 @@ # [3.0.0-beta.21](https://github.com/lerna/lerna/compare/v3.0.0-beta.20...v3.0.0-beta.21) (2018-05-12) |
@@ -10,3 +10,3 @@ "use strict"; | ||
exports.describe = "Run an npm script in each package that contains that script."; | ||
exports.describe = "Run an npm script in each package that contains that script"; | ||
@@ -24,5 +24,4 @@ exports.builder = yargs => { | ||
describe: "Stop when the script fails in a package.\nPass --no-bail to continue despite failure.", | ||
defaultDescription: "true", | ||
default: true, | ||
type: "boolean", | ||
default: undefined, | ||
}, | ||
@@ -33,3 +32,2 @@ stream: { | ||
type: "boolean", | ||
default: undefined, | ||
}, | ||
@@ -40,3 +38,2 @@ parallel: { | ||
type: "boolean", | ||
default: undefined, | ||
}, | ||
@@ -48,5 +45,4 @@ // This option controls prefix for stream output so that it can be disabled to be friendly | ||
describe: "Pass --no-prefix to disable prefixing of streamed output.", | ||
defaultDescription: "true", | ||
default: true, | ||
type: "boolean", | ||
default: undefined, | ||
}, | ||
@@ -53,0 +49,0 @@ "npm-client": { |
35
index.js
@@ -23,11 +23,2 @@ "use strict"; | ||
get defaultOptions() { | ||
return Object.assign({}, super.defaultOptions, { | ||
bail: true, | ||
parallel: false, | ||
prefix: true, | ||
stream: false, | ||
}); | ||
} | ||
initialize() { | ||
@@ -44,2 +35,6 @@ const { script, npmClient = "npm" } = this.options; | ||
// inverted boolean options | ||
this.bail = this.options.bail !== false; | ||
this.prefix = this.options.prefix !== false; | ||
if (script === "env") { | ||
@@ -51,3 +46,5 @@ this.packagesWithScript = this.filteredPackages; | ||
if (!this.packagesWithScript.length) { | ||
this.count = this.packagesWithScript.length; | ||
if (!this.count) { | ||
this.logger.success("run", `No packages found with the lifecycle script '${script}'`); | ||
@@ -74,3 +71,9 @@ | ||
return chain.then(() => { | ||
this.logger.success("run", `Ran npm script '${this.script}' in packages:`); | ||
this.logger.success( | ||
"run", | ||
"Ran npm script '%s' in %d %s:", | ||
this.script, | ||
this.count, | ||
this.count === 1 ? "package" : "packages" | ||
); | ||
this.logger.success("", this.packagesWithScript.map(pkg => `- ${pkg.name}`).join("\n")); | ||
@@ -84,4 +87,4 @@ }); | ||
npmClient: this.npmClient, | ||
prefix: this.options.prefix, | ||
reject: this.options.bail, | ||
prefix: this.prefix, | ||
reject: this.bail, | ||
pkg, | ||
@@ -102,4 +105,6 @@ }; | ||
"run", | ||
"in %d package(s): npm run %s", | ||
this.packagesWithScript.length, | ||
"in %d %s: %s run %s", | ||
this.count, | ||
this.count === 1 ? "package" : "packages", | ||
this.npmClient, | ||
[this.script].concat(this.args).join(" ") | ||
@@ -106,0 +111,0 @@ ); |
{ | ||
"name": "@lerna/run", | ||
"version": "3.0.0-beta.21", | ||
"description": "TODO", | ||
"version": "3.0.0-rc.0", | ||
"description": "Run an npm script in each package that contains that script", | ||
"keywords": [ | ||
@@ -37,12 +37,12 @@ "lerna", | ||
"dependencies": { | ||
"@lerna/batch-packages": "^3.0.0-beta.18", | ||
"@lerna/command": "^3.0.0-beta.21", | ||
"@lerna/filter-options": "^3.0.0-beta.18", | ||
"@lerna/npm-run-script": "^3.0.0-beta.21", | ||
"@lerna/output": "^3.0.0-beta.0", | ||
"@lerna/run-parallel-batches": "^3.0.0-beta.0", | ||
"@lerna/validation-error": "^3.0.0-beta.10", | ||
"@lerna/batch-packages": "^3.0.0-rc.0", | ||
"@lerna/command": "^3.0.0-rc.0", | ||
"@lerna/filter-options": "^3.0.0-rc.0", | ||
"@lerna/npm-run-script": "^3.0.0-rc.0", | ||
"@lerna/output": "^3.0.0-rc.0", | ||
"@lerna/run-parallel-batches": "^3.0.0-rc.0", | ||
"@lerna/validation-error": "^3.0.0-rc.0", | ||
"p-map": "^1.2.0" | ||
}, | ||
"gitHead": "ce5c4842e5c927beaa13779c6429a8d7c5b5a933" | ||
"gitHead": "1ab24c152d3ff5c2b9453bcaafeb4b5e432b2410" | ||
} |
# `@lerna/run` | ||
> description TODO | ||
> Run an npm script in each package that contains that script | ||
## Usage | ||
TODO | ||
```sh | ||
$ lerna run <script> -- [..args] # runs npm run my-script in all packages that have it | ||
$ lerna run test | ||
$ lerna run build | ||
# watch all packages and transpile on change, streaming prefixed output | ||
$ lerna run --parallel watch | ||
``` | ||
Run an [npm script](https://docs.npmjs.com/misc/scripts) in each package that contains that script. A double-dash (`--`) is necessary to pass dashed arguments to the script execution. | ||
## Options | ||
`lerna run` respects the `--concurrency`, `--scope`, and `--ignore` flags (see [Filter Flags](https://www.npmjs.com/package/@lerna/filter-options)). | ||
```sh | ||
$ lerna run --scope my-component test | ||
``` | ||
### `--npm-client <client>` | ||
Must be an executable that knows how to run npm lifecycle scripts. | ||
The default `--npm-client` is `npm`. | ||
```sh | ||
$ lerna run build --npm-client=yarn | ||
``` | ||
May also be configured in `lerna.json`: | ||
```json | ||
{ | ||
"command": { | ||
"run": { | ||
"npmClient": "yarn" | ||
} | ||
} | ||
} | ||
``` | ||
### `--stream` | ||
Stream output from child processes immediately, prefixed with the originating | ||
package name. This allows output from different packages to be interleaved. | ||
```sh | ||
$ lerna run watch --stream | ||
``` | ||
### `--parallel` | ||
Similar to `--stream`, but completely disregards concurrency and topological sorting, running a given command or script immediately in all matching packages with prefixed streaming output. This is the preferred flag for long-running processes such as `npm run watch` run over many packages. | ||
```sh | ||
$ lerna run watch --parallel | ||
``` | ||
> **Note:** It is advised to constrain the scope of this command when using | ||
> the `--parallel` flag, as spawning dozens of subprocesses may be | ||
> harmful to your shell's equanimity (or maximum file descriptor limit, | ||
> for example). YMMV | ||
### `--no-bail` | ||
```sh | ||
# Run an npm script in all packages that contain it, ignoring non-zero (error) exit codes | ||
$ lerna run --no-bail test | ||
``` | ||
By default, `lerna run` will exit with an error if _any_ script run returns a non-zero exit code. | ||
Pass `--no-bail` to disable this behavior, running the script in _all_ packages that contain it regardless of exit code. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14420
6
78