Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@teawithfruit
Copy link
Contributor

Current Behavior

Due to this PR swc-project/pkgs#53 at SWC, it is not possible to use the latest version of @swc/cli in NX.

Expected Behavior

stdout and stderr are now handled more precisely, allowing you to update to the latest version of @swc/cli.

@teawithfruit teawithfruit requested a review from a team as a code owner September 10, 2025 16:11
@vercel
Copy link

vercel bot commented Sep 10, 2025

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

Project Deployment Review Updated (UTC)
nx-dev Ready Ready Preview Dec 16, 2025 10:28am

@netlify
Copy link

netlify bot commented Dec 16, 2025

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 8da1b65

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Dec 16, 2025

View your CI Pipeline Execution ↗ for commit 8da1b65

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 13m 15s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 35s 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-12-16 12:21:54 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 syntax error in the handleCallback function that was preventing Prettier from formatting the file. The malformed conditional logic with an orphaned else-if statement has been restructured to properly handle stdout and stderr within the correct if/else if blocks, resolving the format:check failure.

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

Suggested Fix changes
diff --git a/packages/js/src/utils/swc/compile-swc.ts b/packages/js/src/utils/swc/compile-swc.ts
index ba124df796..aaf0b4bef2 100644
--- a/packages/js/src/utils/swc/compile-swc.ts
+++ b/packages/js/src/utils/swc/compile-swc.ts
@@ -161,22 +161,15 @@ export async function* compileSwcWatch(
 
       handleCallback = async (type: string, data?: string) => {
         if (type === 'stdout') {
-          process.stdout.write(data);
-          if (data.includes('Successfully')) {
-            // Handle success case
-          }
-        } else if (type === 'stderr') {
-          // Process stderr data appropriately
-        }
           process.stdout.write(data);
           if (!data.startsWith('Watching')) {
             const swcStatus = data.includes('Successfully');
-  
+
             if (initialPostCompile) {
               await postCompilationCallback();
               initialPostCompile = false;
             }
-  
+
             if (
               normalizedOptions.skipTypeCheck ||
               normalizedOptions.isTsSolutionSetup
@@ -184,11 +177,11 @@ export async function* compileSwcWatch(
               next(getResult(swcStatus));
               return;
             }
-  
+
             if (!typeCheckOptions) {
               typeCheckOptions = getTypeCheckOptions(normalizedOptions);
             }
-  
+
             const delayed = delay(5000);
             next(
               getResult(
@@ -196,22 +189,24 @@ export async function* compileSwcWatch(
                   delayed
                     .start()
                     .then(() => ({ tscStatus: false, type: 'timeout' })),
-                  runTypeCheck(typeCheckOptions).then(({ errors, warnings }) => {
-                    const hasErrors = errors.length > 0;
-                    if (hasErrors) {
-                      printDiagnostics(errors, warnings);
+                  runTypeCheck(typeCheckOptions).then(
+                    ({ errors, warnings }) => {
+                      const hasErrors = errors.length > 0;
+                      if (hasErrors) {
+                        printDiagnostics(errors, warnings);
+                      }
+                      return {
+                        tscStatus: !hasErrors,
+                        type: 'tsc',
+                      };
                     }
-                    return {
-                      tscStatus: !hasErrors,
-                      type: 'tsc',
-                    };
-                  }),
+                  ),
                 ]).then(({ type, tscStatus }) => {
                   if (type === 'tsc') {
                     delayed.cancel();
                     return tscStatus && swcStatus;
                   }
-  
+
                   return swcStatus;
                 })
               )
@@ -224,8 +219,8 @@ export async function* compileSwcWatch(
           }
           next(getResult(false));
         }
-      }
-      
+      };
+
       stdoutOnData = async (data?: string) => {
         handleCallback('stdout', data);
       };

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 Swip-OTJz

Apply fix locally with your editor ↗   View interactive diff ↗


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

@Coly010 Coly010 merged commit de966a2 into nrwl:master Dec 16, 2025
17 of 19 checks passed
FrozenPandaz pushed a commit that referenced this pull request Dec 16, 2025
…wc/cli version (#32685)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Due to this PR swc-project/pkgs#53 at SWC, it is
not possible to use the latest version of @swc/cli in NX.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
stdout and stderr are now handled more precisely, allowing you to update
to the latest version of @swc/cli.

---------

Co-authored-by: Colum Ferry <[email protected]>
@teawithfruit teawithfruit deleted the patch-1 branch December 16, 2025 21:04
@github-actions
Copy link
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants