Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Redirect messages to stderr #53

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

magic-akari
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Aug 30, 2024

🦋 Changeset detected

Latest commit: d4865bf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@swc/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

kdy1
kdy1 previously approved these changes Aug 30, 2024
@kdy1 kdy1 enabled auto-merge (squash) August 30, 2024 12:21
@kdy1
Copy link
Member

kdy1 commented Oct 22, 2024

Can you rebase?

auto-merge was automatically disabled October 22, 2024 09:21

Head branch was pushed to by a user without write access

Copy link

vercel bot commented Oct 22, 2024

@magic-akari is attempting to deploy a commit to the SWC Project Team on Vercel.

A member of the Team first needs to authorize it.

@magic-akari magic-akari requested a review from kdy1 October 28, 2024 08:55
kdy1
kdy1 previously approved these changes Oct 29, 2024
@kdy1 kdy1 merged commit 76e98e3 into swc-project:main Oct 29, 2024
10 checks passed
@rathpc
Copy link

rathpc commented Jan 10, 2025

Is there any context about why this change was made?

@kdy1
Copy link
Member

kdy1 commented Jan 10, 2025

Error messages should go to the stderr. It’s correct default, so we fixed it.

@Reflejo
Copy link

Reflejo commented Jan 11, 2025

That makes sense, although this PR also changed a non-error message, aka:

-            console.log(message, duration.toFixed(2));
+            stderr.write(message);

which in turned broke nx https://github.com/nrwl/nx/blob/master/packages/js/src/utils/swc/compile-swc.ts#L95 - Pretty nasty the way they check for success (instead of exit code) but it broke nonetheless

@rathpc
Copy link

rathpc commented Jan 11, 2025

That makes sense, although this PR also changed a non-error message, aka:

-            console.log(message, duration.toFixed(2));
+            stderr.write(message);

which in turned broke nx https://github.com/nrwl/nx/blob/master/packages/js/src/utils/swc/compile-swc.ts#L95 - Pretty nasty the way they check for success (instead of exit code) but it broke nonetheless

This was the reason I ended up here actually. Attempted updating swc in an NX project and learned pretty quick it did not work as expected despite a successful build.

@kdy1
Copy link
Member

kdy1 commented Jan 11, 2025

  •        console.log(message, duration.toFixed(2));
    

This is a log, so it should go to stderr

ndcunningham added a commit to nrwl/nx that referenced this pull request Jan 13, 2025
Improves our error handling for swc when using `@nx/js:swc` executor

<!-- 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 -->
The executor fails to build if the workspace has a newer versions of
`@swc/cli` e.g.(`0.6.0`) is installed since it now uses stderr instead
of message to log errors.
RE: swc-project/pkgs#53

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The executor should pass in this scenario.


## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #29599
FrozenPandaz pushed a commit to nrwl/nx that referenced this pull request Jan 15, 2025
Improves our error handling for swc when using `@nx/js:swc` executor

<!-- 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 -->
The executor fails to build if the workspace has a newer versions of
`@swc/cli` e.g.(`0.6.0`) is installed since it now uses stderr instead
of message to log errors.
RE: swc-project/pkgs#53

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The executor should pass in this scenario.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #29599

(cherry picked from commit 6181592)
isaacplmann pushed a commit to nrwl/nx that referenced this pull request Feb 11, 2025
Improves our error handling for swc when using `@nx/js:swc` executor

<!-- 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 -->
The executor fails to build if the workspace has a newer versions of
`@swc/cli` e.g.(`0.6.0`) is installed since it now uses stderr instead
of message to log errors.
RE: swc-project/pkgs#53

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The executor should pass in this scenario.


## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #29599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants