@lerna/run
Advanced tools
Comparing version 5.6.1 to 6.0.0-alpha.0
@@ -78,3 +78,3 @@ "use strict"; | ||
group: "Command Options:", | ||
describe: "When useNx is true, show verbose output from dependent tasks.", | ||
describe: "When useNx is not false, show verbose output from dependent tasks.", | ||
type: "boolean", | ||
@@ -81,0 +81,0 @@ }, |
32
index.js
@@ -11,3 +11,3 @@ /* eslint-disable */ | ||
const { output } = require("@lerna/output"); | ||
const { Profiler } = require("@lerna/profiler"); | ||
const { Profiler, generateProfileOutputPath } = require("@lerna/profiler"); | ||
const { timer } = require("@lerna/timer"); | ||
@@ -41,2 +41,10 @@ const { runTopologically } = require("@lerna/run-topologically"); | ||
// Check this.argv (not this.options) so that we only error in this case when --npm-client is set via the CLI (not via lerna.json which is a legitimate use case for other things) | ||
if (this.argv.npmClient && this.options.useNx !== false) { | ||
throw new ValidationError( | ||
"run", | ||
"The legacy task runner option `--npm-client` is not currently supported. Please open an issue on https://github.com/lerna/lerna if you require this feature." | ||
); | ||
} | ||
// inverted boolean options | ||
@@ -71,3 +79,3 @@ this.bail = this.options.bail !== false; | ||
execute() { | ||
if (!this.options.useNx) { | ||
if (this.options.useNx === false) { | ||
this.logger.info( | ||
@@ -85,3 +93,3 @@ "", | ||
if (this.options.useNx) { | ||
if (this.options.useNx !== false) { | ||
chain = chain.then(() => this.runScriptsUsingNx()); | ||
@@ -191,2 +199,7 @@ } else if (this.options.parallel) { | ||
} | ||
if (this.options.profile) { | ||
const absolutePath = generateProfileOutputPath(this.options.profileLocation); | ||
// Nx requires a workspace relative path for this | ||
process.env.NX_PROFILE = path.relative(this.project.rootPath, absolutePath); | ||
} | ||
performance.mark("init-local"); | ||
@@ -247,2 +260,6 @@ this.configureNxOutput(); | ||
if (this.options.prefix === false && !this.options.stream) { | ||
this.logger.warn(this.name, `"no-prefix" is ignored when not using streaming output.`); | ||
} | ||
const outputStyle = this.options.stream | ||
@@ -342,10 +359,9 @@ ? this.prefix | ||
return nxOutput; | ||
} catch (e) { | ||
} catch (err) { | ||
// This should be unreachable and we would want to know if it somehow occurred in a user's setup. | ||
this.logger.error( | ||
"\n", | ||
"You have set 'useNx: true' in lerna.json, but you haven't installed Nx as a dependency.\n" + | ||
"To do it run 'npm install -D nx@latest' or 'yarn add -D -W nx@latest'.\n" + | ||
"Optional: To configure the caching and distribution run 'npx nx init' after installing it." | ||
"There was a critical error when configuring the task runner, please report this on https://github.com/lerna/lerna" | ||
); | ||
process.exit(1); | ||
throw err; | ||
} | ||
@@ -352,0 +368,0 @@ } |
{ | ||
"name": "@lerna/run", | ||
"version": "5.6.1", | ||
"version": "6.0.0-alpha.0", | ||
"description": "Run an npm script in each package that contains that script", | ||
@@ -36,14 +36,14 @@ "keywords": [ | ||
"dependencies": { | ||
"@lerna/command": "5.6.1", | ||
"@lerna/filter-options": "5.6.1", | ||
"@lerna/npm-run-script": "5.6.1", | ||
"@lerna/output": "5.6.1", | ||
"@lerna/profiler": "5.6.1", | ||
"@lerna/run-topologically": "5.6.1", | ||
"@lerna/timer": "5.6.1", | ||
"@lerna/validation-error": "5.6.1", | ||
"@lerna/command": "6.0.0-alpha.0", | ||
"@lerna/filter-options": "6.0.0-alpha.0", | ||
"@lerna/npm-run-script": "6.0.0-alpha.0", | ||
"@lerna/output": "6.0.0-alpha.0", | ||
"@lerna/profiler": "6.0.0-alpha.0", | ||
"@lerna/run-topologically": "6.0.0-alpha.0", | ||
"@lerna/timer": "6.0.0-alpha.0", | ||
"@lerna/validation-error": "6.0.0-alpha.0", | ||
"fs-extra": "^9.1.0", | ||
"p-map": "^4.0.0" | ||
}, | ||
"gitHead": "c455b1ce9c6de70bd876c1304cc93124b6a1bbaa" | ||
"gitHead": "84597c511c4503562c641b481a2854137465ba5c" | ||
} |
@@ -114,21 +114,4 @@ # `@lerna/run` | ||
### `useNx` (experimental) | ||
### `useNx=false` | ||
Enables integration with [Nx](https://nx.dev). Setting `"useNx": true` in `lerna.json` will tell Lerna to delegate | ||
running tasks to Nx instead of using `p-map` and `p-queue`. This only works if Nx is installed and `nx.json` is present. | ||
Example of `nx.json`: | ||
```json | ||
{ | ||
"extends": "nx/presets/npm.json", | ||
"tasksRunnerOptions": { | ||
"default": { | ||
"runner": "nx/tasks-runners/default", | ||
"options": { | ||
"cacheableOperations": ["build"] | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
By setting `useNx` to `false` you can use the legacy task running implementations in `lerna` (`p-map` and `p-queue`) instead of using the default modern task runner implementation powered by [Nx](https://nx.dev). |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
20360
395
1
117
4
+ Added@lerna/child-process@6.0.0-alpha.0(transitive)
+ Added@lerna/collect-updates@6.0.0-alpha.0(transitive)
+ Added@lerna/command@6.0.0-alpha.0(transitive)
+ Added@lerna/describe-ref@6.0.0-alpha.0(transitive)
+ Added@lerna/filter-options@6.0.0-alpha.0(transitive)
+ Added@lerna/filter-packages@6.0.0-alpha.0(transitive)
+ Added@lerna/get-npm-exec-opts@6.0.0-alpha.0(transitive)
+ Added@lerna/npm-run-script@6.0.0-alpha.0(transitive)
+ Added@lerna/output@6.0.0-alpha.0(transitive)
+ Added@lerna/package@6.0.0-alpha.0(transitive)
+ Added@lerna/package-graph@6.0.0-alpha.0(transitive)
+ Added@lerna/prerelease-id-from-version@6.0.0-alpha.0(transitive)
+ Added@lerna/profiler@6.0.0-alpha.0(transitive)
+ Added@lerna/project@6.0.0-alpha.0(transitive)
+ Added@lerna/query-graph@6.0.0-alpha.0(transitive)
+ Added@lerna/run-topologically@6.0.0-alpha.0(transitive)
+ Added@lerna/timer@6.0.0-alpha.0(transitive)
+ Added@lerna/validation-error@6.0.0-alpha.0(transitive)
+ Added@lerna/write-log-file@6.0.0-alpha.0(transitive)
- Removed@lerna/child-process@5.6.1(transitive)
- Removed@lerna/collect-updates@5.6.1(transitive)
- Removed@lerna/command@5.6.1(transitive)
- Removed@lerna/describe-ref@5.6.1(transitive)
- Removed@lerna/filter-options@5.6.1(transitive)
- Removed@lerna/filter-packages@5.6.1(transitive)
- Removed@lerna/get-npm-exec-opts@5.6.1(transitive)
- Removed@lerna/npm-run-script@5.6.1(transitive)
- Removed@lerna/output@5.6.1(transitive)
- Removed@lerna/package@5.6.1(transitive)
- Removed@lerna/package-graph@5.6.1(transitive)
- Removed@lerna/prerelease-id-from-version@5.6.1(transitive)
- Removed@lerna/profiler@5.6.1(transitive)
- Removed@lerna/project@5.6.1(transitive)
- Removed@lerna/query-graph@5.6.1(transitive)
- Removed@lerna/run-topologically@5.6.1(transitive)
- Removed@lerna/timer@5.6.1(transitive)
- Removed@lerna/validation-error@5.6.1(transitive)
- Removed@lerna/write-log-file@5.6.1(transitive)
Updated@lerna/command@6.0.0-alpha.0
Updated@lerna/output@6.0.0-alpha.0
Updated@lerna/timer@6.0.0-alpha.0