Skip to content

Conversation

@avens19
Copy link

@avens19 avens19 commented Nov 14, 2025

Allows setting a default output style instead of having to include it on every command

Closes #27490

Current Behavior

We must specify --outputStyle on every command

Expected Behavior

Should allow overriding the default with an environment variable

Related Issue(s)

#27490

Fixes #27490

@avens19 avens19 requested review from a team as code owners November 14, 2025 16:54
@avens19 avens19 requested a review from leosvelperez November 14, 2025 16:54
@netlify
Copy link

netlify bot commented Nov 14, 2025

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 55c3ead

@vercel
Copy link

vercel bot commented Nov 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Nov 28, 2025 6:00pm

@avens19
Copy link
Author

avens19 commented Nov 28, 2025

@AgentEnder any chance you could take another look?

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Nov 28, 2025

View your CI Pipeline Execution ↗ for commit 55c3ead

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 39m 40s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 40s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 11s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-28 18:41:41 UTC

Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Important

A new CI pipeline execution was requested that may update the conclusion below...

Nx Cloud is proposing a fix for your failed CI:

These changes fix the format:check failure by applying Prettier formatting to the code introduced in the PR. The original changes adding NX_DEFAULT_OUTPUT_STYLE support had inconsistent spacing and indentation that violated the project's formatting standards. Running nx format automatically corrected the formatting issues in both the test file and source file.

We verified this fix by re-running nx-cloud record -- nx format:check.

Suggested Fix changes
diff --git a/packages/nx/src/command-line/yargs-utils/shared-options.spec.ts b/packages/nx/src/command-line/yargs-utils/shared-options.spec.ts
index 0062d5bd6f..a16ae62278 100644
--- a/packages/nx/src/command-line/yargs-utils/shared-options.spec.ts
+++ b/packages/nx/src/command-line/yargs-utils/shared-options.spec.ts
@@ -113,8 +113,7 @@ describe('shared-options', () => {
           const result = command.parseSync([]);
           expect(result.outputStyle).toEqual('stream-without-prefixes');
         }
-      )
-    );
+      ));
 
     it('should set NX_TUI if using not set', () =>
       withEnvironmentVariables(
diff --git a/packages/nx/src/command-line/yargs-utils/shared-options.ts b/packages/nx/src/command-line/yargs-utils/shared-options.ts
index ddd0d3aff8..ff5dfda909 100644
--- a/packages/nx/src/command-line/yargs-utils/shared-options.ts
+++ b/packages/nx/src/command-line/yargs-utils/shared-options.ts
@@ -326,10 +326,11 @@ export function withOutputStyleOption<T>(
     .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.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) => {

Because this branch comes from a fork, it is not possible for us to apply fixes directly, but you can apply the changes locally using the available options below.

Apply changes locally with:

npx nx-cloud apply-locally 4gl0-owqG

Apply fix locally with your editor ↗   View interactive diff ↗


🎓 Learn more about Self-Healing CI on nx.dev

Allows setting a default output style instead of having to include it on every command

Closes nrwl#27490
@avens19 avens19 force-pushed the default-output-style branch from 6d770d9 to 55c3ead Compare November 28, 2025 17:54
@avens19 avens19 changed the title feat(core): Add NX_DEFAULT_OUTPUT_STYLE env var feat(core): add NX_DEFAULT_OUTPUT_STYLE env var Nov 28, 2025
@avens19 avens19 requested a review from AgentEnder November 28, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants