Skip to content

Commit

Permalink
feat(core): add NX_PARALLEL env var (#19488)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder authored Oct 9, 2023
1 parent c38bd37 commit 024966e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/shared/reference/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The following environment variables are ones that you can set to change the beha
| NX_PROFILE | string | Prepend `NX_PROFILE=profile.json` before running targets with Nx to generate a file that be [loaded in Chrome dev tools](/recipes/troubleshooting/performance-profiling) to visualize the performance of Nx across multiple processes. |
| NX_PROJECT_GRAPH_CACHE_DIRECTORY | string | The project graph cache is stored in `node_modules/.cache/nx` by default. Set this variable to use a different directory. |
| NX_PROJECT_GRAPH_MAX_WORKERS | number | The number of workers to use when calculating the project graph. |
| NX_PARALLEL | number | The number of tasks Nx should run in parallel. Overrides any configured value inside nx.json |
| NX_RUNNER | string | The name of task runner from the config to use. Can be overridden on the command line with `--runner`. Not read if NX_TASKS_RUNNER is set. |
| NX_SKIP_NX_CACHE | boolean | Rerun the tasks even when the results are available in the cache |
| NX_TASKS_RUNNER | string | The name of task runner from the config to use. Can be overridden on the command line with `--runner`. Preferred over NX_RUNNER. |
Expand Down
8 changes: 6 additions & 2 deletions packages/nx/src/utils/command-line-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,14 @@ export function splitArgsIntoNxArgsAndOverrides(
} else if (
args['parallel'] === 'true' ||
args['parallel'] === true ||
args['parallel'] === ''
args['parallel'] === '' ||
process.env.NX_PARALLEL // dont require passing --parallel if NX_PARALLEL is set
) {
nxArgs['parallel'] = Number(
nxArgs['maxParallel'] || nxArgs['max-parallel'] || 3
nxArgs['maxParallel'] ||
nxArgs['max-parallel'] ||
process.env.NX_PARALLEL ||
3
);
} else if (args['parallel'] !== undefined) {
nxArgs['parallel'] = Number(args['parallel']);
Expand Down

1 comment on commit 024966e

@vercel
Copy link

@vercel vercel bot commented on 024966e Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.