@lerna/run
Advanced tools
Comparing version 3.0.0-beta.12 to 3.0.0-beta.13
@@ -6,2 +6,20 @@ # Change Log | ||
<a name="3.0.0-beta.13"></a> | ||
# [3.0.0-beta.13](https://github.com/lerna/lerna/compare/v3.0.0-beta.12...v3.0.0-beta.13) (2018-03-31) | ||
### Bug Fixes | ||
* Use ValidationError instead of Error ([bea6bc3](https://github.com/lerna/lerna/commit/bea6bc3)) | ||
* **run:** Exit early when no packages contain the targeted lifecycle ([c8a5526](https://github.com/lerna/lerna/commit/c8a5526)) | ||
### Features | ||
* Enable progress bars only when necessary ([b766c83](https://github.com/lerna/lerna/commit/b766c83)) | ||
<a name="3.0.0-beta.12"></a> | ||
@@ -8,0 +26,0 @@ # [3.0.0-beta.12](https://github.com/lerna/lerna/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2018-03-30) |
30
index.js
@@ -10,2 +10,3 @@ "use strict"; | ||
const output = require("@lerna/output"); | ||
const ValidationError = require("@lerna/validation-error"); | ||
@@ -33,28 +34,23 @@ module.exports = factory; | ||
initialize() { | ||
const { script } = this.options; | ||
const { script, npmClient = "npm" } = this.options; | ||
this.script = script; | ||
this.args = this.options["--"] || []; | ||
this.npmClient = npmClient; | ||
if (!script) { | ||
throw new Error("You must specify which npm script to run."); | ||
throw new ValidationError("ENOSCRIPT", "You must specify a lifecycle script to run"); | ||
} | ||
const { parallel, stream, npmClient } = this.options; | ||
this.npmClient = npmClient || "npm"; | ||
const { filteredPackages } = this; | ||
if (script === "env") { | ||
this.packagesWithScript = filteredPackages; | ||
this.packagesWithScript = this.filteredPackages; | ||
} else { | ||
this.packagesWithScript = filteredPackages.filter(pkg => pkg.scripts && pkg.scripts[script]); | ||
this.packagesWithScript = this.filteredPackages.filter(pkg => pkg.scripts && pkg.scripts[script]); | ||
} | ||
if (!this.packagesWithScript.length) { | ||
this.logger.warn(`No packages found with the npm script '${script}'`); | ||
} | ||
this.logger.success("run", `No packages found with the lifecycle script '${script}'`); | ||
if (parallel || stream) { | ||
// don't interrupt streaming stdio | ||
this.logger.disableProgress(); | ||
// still exits zero, aka "ok" | ||
return false; | ||
} | ||
@@ -77,6 +73,4 @@ | ||
return chain.then(() => { | ||
if (this.packagesWithScript.length) { | ||
this.logger.success("run", `Ran npm script '${this.script}' in packages:`); | ||
this.logger.success("", this.packagesWithScript.map(pkg => `- ${pkg.name}`).join("\n")); | ||
} | ||
this.logger.success("run", `Ran npm script '${this.script}' in packages:`); | ||
this.logger.success("", this.packagesWithScript.map(pkg => `- ${pkg.name}`).join("\n")); | ||
}); | ||
@@ -83,0 +77,0 @@ } |
{ | ||
"name": "@lerna/run", | ||
"version": "3.0.0-beta.12", | ||
"version": "3.0.0-beta.13", | ||
"description": "TODO", | ||
@@ -38,10 +38,11 @@ "keywords": [ | ||
"@lerna/batch-packages": "^3.0.0-beta.11", | ||
"@lerna/command": "^3.0.0-beta.12", | ||
"@lerna/command": "^3.0.0-beta.13", | ||
"@lerna/filter-options": "^3.0.0-beta.9", | ||
"@lerna/npm-run-script": "^3.0.0-beta.12", | ||
"@lerna/npm-run-script": "^3.0.0-beta.13", | ||
"@lerna/output": "^3.0.0-beta.0", | ||
"@lerna/run-parallel-batches": "^3.0.0-beta.0", | ||
"@lerna/validation-error": "^3.0.0-beta.10", | ||
"p-map": "^1.2.0" | ||
}, | ||
"gitHead": "05dce5c0e4bca8dc894a99ed28337c85c211b37c" | ||
"gitHead": "4cae54bce76bf156e71a2881418104c442f97c62" | ||
} |
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
9244
8
152