Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following environment variables are ones that you can set to change the beha
| `NX_CACHE_PROJECT_GRAPH` | boolean | If set to `false`, disables the project graph cache. Most useful when developing a plugin that modifies the project graph. |
| `NX_DAEMON` | boolean | If set to `false`, disables the Nx daemon process. Disable the daemon to print `console.log` statements in plugin code you are developing. |
| `NX_DEFAULT_PROJECT` | string | The default project used for commands which require a project. e.g. `nx build`, `nx g component`, etc. |
| `NX_DEFAULT_OUTPUT_STYLE` | string | The default output style to use when running tasks. Can be overridden on the command line with `--outputStyle`. |
| `NX_HEAD` | string | The default head branch to use when calculating the affected projects. Can be overridden on the command line with `--head`. |
| `NX_PERF_LOGGING` | boolean | If set to `true`, will print debug information useful for profiling executors and Nx itself |
| `NX_PROFILE` | string | Prepend `NX_PROFILE=profile.json` before running targets with Nx to generate a file that be [loaded in Chrome dev tools](/docs/troubleshooting/performance-profiling) to visualize the performance of Nx across multiple processes. |
Expand Down
15 changes: 15 additions & 0 deletions packages/nx/src/command-line/yargs-utils/shared-options.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ describe('shared-options', () => {
}
));

it('should use NX_DEFAULT_OUTPUT_STYLE if not set', () =>
withEnvironmentVariables(
{
NX_TUI: false,
CI: 'false',
NX_TUI_SKIP_CAPABILITY_CHECK: 'true',
NX_DEFAULT_OUTPUT_STYLE: 'stream-without-prefixes',
},
() => {
const command = withOutputStyleOption(argv);
const result = command.parseSync([]);
expect(result.outputStyle).toEqual('stream-without-prefixes');
}
));

it('should set NX_TUI if using not set', () =>
withEnvironmentVariables(
{
Expand Down
9 changes: 9 additions & 0 deletions packages/nx/src/command-line/yargs-utils/shared-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ export function withOutputStyleOption<T>(
choices,
})
.middleware([
(args) => {
if (
!args.outputStyle &&
process.env.NX_DEFAULT_OUTPUT_STYLE &&
choices.includes(process.env.NX_DEFAULT_OUTPUT_STYLE as OutputStyle)
) {
args.outputStyle = process.env.NX_DEFAULT_OUTPUT_STYLE;
}
},
(args) => {
const useTui = shouldUseTui(readNxJson(), args as NxArgs);
if (useTui) {
Expand Down
Loading