@lerna/run
Advanced tools
Comparing version 3.18.5 to 3.20.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [3.20.0](https://github.com/lerna/lerna/compare/v3.19.0...v3.20.0) (2019-12-27) | ||
### Bug Fixes | ||
* **collect-dependents:** Avoid skipping dependents of cyclic dependencies ([#2380](https://github.com/lerna/lerna/issues/2380)) ([bd19a34](https://github.com/lerna/lerna/commit/bd19a34debf3344e94386b4ffd4b3fe87efb4641)) | ||
### Features | ||
* Add `--profile` option to `lerna exec` and `lerna run` ([#2376](https://github.com/lerna/lerna/issues/2376)) ([6290174](https://github.com/lerna/lerna/commit/62901748f818516d58efdfd955eacb447e270351)) | ||
## [3.18.5](https://github.com/lerna/lerna/compare/v3.18.4...v3.18.5) (2019-11-20) | ||
@@ -8,0 +24,0 @@ |
@@ -62,2 +62,12 @@ "use strict"; | ||
}, | ||
profile: { | ||
group: "Command Options:", | ||
describe: "Profile script executions and output performance profile to default location.", | ||
type: "boolean", | ||
}, | ||
"profile-location": { | ||
group: "Command Options:", | ||
describe: "Output performance profile to custom location instead of default project root.", | ||
type: "string", | ||
}, | ||
}); | ||
@@ -64,0 +74,0 @@ |
37
index.js
@@ -8,2 +8,3 @@ "use strict"; | ||
const output = require("@lerna/output"); | ||
const Profiler = require("@lerna/profiler"); | ||
const timer = require("@lerna/timer"); | ||
@@ -131,11 +132,35 @@ const runTopologically = require("@lerna/run-topologically"); | ||
runScriptInPackagesTopological() { | ||
const runner = this.options.stream | ||
getRunner() { | ||
return this.options.stream | ||
? pkg => this.runScriptInPackageStreaming(pkg) | ||
: pkg => this.runScriptInPackageCapturing(pkg); | ||
} | ||
return runTopologically(this.packagesWithScript, runner, { | ||
runScriptInPackagesTopological() { | ||
let profiler; | ||
let runner; | ||
if (this.options.profile) { | ||
profiler = new Profiler({ | ||
concurrency: this.concurrency, | ||
log: this.logger, | ||
outputDirectory: this.options.profileLocation, | ||
}); | ||
const callback = this.getRunner(); | ||
runner = pkg => profiler.run(() => callback(pkg), pkg.name); | ||
} else { | ||
runner = this.getRunner(); | ||
} | ||
let chain = runTopologically(this.packagesWithScript, runner, { | ||
concurrency: this.concurrency, | ||
rejectCycles: this.options.rejectCycles, | ||
}); | ||
if (profiler) { | ||
chain = chain.then(results => profiler.output().then(() => results)); | ||
} | ||
return chain; | ||
} | ||
@@ -148,7 +173,3 @@ | ||
runScriptInPackagesLexical() { | ||
const runner = this.options.stream | ||
? pkg => this.runScriptInPackageStreaming(pkg) | ||
: pkg => this.runScriptInPackageCapturing(pkg); | ||
return pMap(this.packagesWithScript, runner, { concurrency: this.concurrency }); | ||
return pMap(this.packagesWithScript, this.getRunner(), { concurrency: this.concurrency }); | ||
} | ||
@@ -155,0 +176,0 @@ |
{ | ||
"name": "@lerna/run", | ||
"version": "3.18.5", | ||
"version": "3.20.0", | ||
"description": "Run an npm script in each package that contains that script", | ||
@@ -36,5 +36,6 @@ "keywords": [ | ||
"@lerna/command": "3.18.5", | ||
"@lerna/filter-options": "3.18.4", | ||
"@lerna/filter-options": "3.20.0", | ||
"@lerna/npm-run-script": "3.16.5", | ||
"@lerna/output": "3.13.0", | ||
"@lerna/profiler": "3.20.0", | ||
"@lerna/run-topologically": "3.18.5", | ||
@@ -45,3 +46,3 @@ "@lerna/timer": "3.13.0", | ||
}, | ||
"gitHead": "2612f51e7eecec58eacf0571724e6989e4b8e42d" | ||
"gitHead": "b90f4d3618b2327716840aa2a2619497c793c8aa" | ||
} |
@@ -85,1 +85,25 @@ # `@lerna/run` | ||
This option can be useful when piping results to other processes, such as editor plugins. | ||
### `--profile` | ||
Profiles the script executions and produces a performance profile which can be analyzed using DevTools in a | ||
Chromium-based browser (direct url: `devtools://devtools/bundled/devtools_app.html`). The profile shows a timeline of | ||
the script executions where each execution is assigned to an open slot. The number of slots is determined by the | ||
`--concurrency` option and the number of open slots is determined by `--concurrency` minus the number of ongoing | ||
operations. The end result is a visualization of the parallel execution of your scripts. | ||
The default location of the performance profile output is at the root of your project. | ||
```sh | ||
$ lerna run build --profile | ||
``` | ||
> **Note:** Lerna will only profile when topological sorting is enabled (i.e. without `--parallel` and `--no-sort`). | ||
### `--profile-location <location>` | ||
You can provide a custom location for the performance profile output. The path provided will be resolved relative to the current working directory. | ||
```sh | ||
$ lerna run build --profile --profile-location=logs/profile/ | ||
``` |
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
25586
233
109
9
+ Added@lerna/profiler@3.20.0
+ Added@lerna/collect-updates@3.20.0(transitive)
+ Added@lerna/filter-options@3.20.0(transitive)
+ Added@lerna/profiler@3.20.0(transitive)
+ Addedfs-extra@8.1.0(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addeduniversalify@0.1.2(transitive)
+ Addedupath@1.2.0(transitive)
- Removed@lerna/collect-updates@3.18.0(transitive)
- Removed@lerna/filter-options@3.18.4(transitive)
Updated@lerna/filter-options@3.20.0