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: Fix watchMode process logs not showing color #2052

Conversation

SubsequentlySneeds
Copy link

@SubsequentlySneeds SubsequentlySneeds commented Aug 8, 2023

Summary:

When selecting "run on Android" from the Metro menu, the first info label is bolded and cyan, but the second one prints without color or bolding:

Code_ojM1HKCg96
(VSCode terminal)

This is because the child process spawns without color by default, even if the parent has color enabled. This causes chalk to print without color escape sequences to the child stdout, which is then piped back to the parent stdout without color, even though it is capable of displaying it.

This change simply adds an env variable to force color in the child process if the parent supports color.

Test Plan:

Pasted the code into the transpiled watchMode.js file (replacing "chalk" with "_chalk().default" for ES Module interop) in the React Native project the issue was first observed in and re-ran the same operation:

Code_hGwZ4IvBmN

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Nice find, thank you!

@thymikee
Copy link
Member

We've made some changes to the watchMode, @SubsequentlySneeds would you mind rebasing? 🙏🏼

@SubsequentlySneeds
Copy link
Author

Rebased to the latest watchMode.ts

@SubsequentlySneeds SubsequentlySneeds force-pushed the main-1 branch 2 times, most recently from ade9baf to 019b040 Compare August 18, 2023 02:02
@thymikee
Copy link
Member

thymikee commented Aug 19, 2023

cc @huntie – as we're freezing cli-plugin-metro, could you import this change to community-cli-plugin?

@szymonrybczak would like to test it on Windows as well

huntie added a commit to huntie/react-native that referenced this pull request Aug 21, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: 23d01b687bff73861964d1b3a718583be829e686
huntie added a commit to huntie/react-native that referenced this pull request Aug 21, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: 8f92a125aaa6c9268b716fdfa7fac3191c844eca
huntie added a commit to huntie/react-native that referenced this pull request Aug 21, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: fbaadec847667cd7153f455a6f40107bc9377d17
huntie added a commit to huntie/react-native that referenced this pull request Aug 21, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: fd755855cddb58bfa9006c7930227bd54816465c
huntie added a commit to huntie/react-native that referenced this pull request Aug 21, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: 28082b7cfb52eb80318ae9205f947e3d819ff6cb
huntie added a commit to huntie/react-native that referenced this pull request Aug 22, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: 4b0dd056c0a5df5f6ca47da9f07dcc45ea41834f
huntie added a commit to huntie/react-native that referenced this pull request Aug 22, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: e4aa3fbe49c1c0f9a5e04a42e653d96aa8b5619a
huntie added a commit to huntie/react-native that referenced this pull request Aug 22, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: da761433fb62eb2ff82a43898aec501a73c40f32
huntie added a commit to huntie/react-native that referenced this pull request Aug 22, 2023
…39074)

Summary:
Pull Request resolved: facebook#39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: 692d245d02c5880b30fa49b885aa599ced06cfd1
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Aug 22, 2023
Summary:
Pull Request resolved: #39074

Changelog: [Internal]

Publish new versions of `react-native/community-cli-plugin` and `react-native/dev-middleware` (which are now in a minimum viable state) for early integrators.

Also syncs final upstream changes from CLI:
- react-native-community/cli#2035
- react-native-community/cli#2052

#publish-packages-to-npm
bypass-github-export-checks

Reviewed By: motiz88

Differential Revision: D48465522

fbshipit-source-id: 987280996938af35b752b998969ea112a15deb57
@szymonrybczak
Copy link
Collaborator

Closing this PR, as the code is not longer in this repository - we migrated that part of codebase to React Native repo, and as I can see @huntie already added this change. Thanks for contribution!

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.

4 participants