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

--no-color fix #5207

Merged
merged 2 commits into from
Jan 19, 2025
Merged

--no-color fix #5207

merged 2 commits into from
Jan 19, 2025

Conversation

amcaplan
Copy link
Contributor

@amcaplan amcaplan commented Jan 15, 2025

WHY are these changes introduced?

The user's expressed --no-color preference is not respected when logging warnings and errors.

Additional context: Some versions of node color console.warn output yellow and console.error output red unless they output is already colored explicitly. While this has been rolled back, it seems safest to stop relying on these functions and simply write directly to stdout/stderr.

WHAT is this pull request doing?

$ p shopify kitchen-sink static --no-color

Before:

Screenshot 2025-01-15 at 23 31 49

After:

Screenshot 2025-01-15 at 23 33 46

How to test your changes?

$ p shopify kitchen-sink static with and without --no-color

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@amcaplan amcaplan requested review from a team as code owners January 15, 2025 21:34
Copy link
Contributor

@jamieguerrero jamieguerrero left a comment

Choose a reason for hiding this comment

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

Tophatted and LGTM!

Copy link
Contributor

github-actions bot commented Jan 15, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.25% (-0.01% 🔻)
8883/11804
🟡 Branches
70.43% (-0.02% 🔻)
4328/6145
🟡 Functions 75.08% 2329/3102
🟡 Lines 75.81% 8394/11073
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app-event-watcher.ts
93.83% (-1.23% 🔻)
86.49% (-2.7% 🔻)
90.48% 98.61%
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88% (-4% 🔻)
100%
98.33% (-1.67% 🔻)

Test suite run success

2003 tests passing in 905 suites.

Report generated by 🧪jest coverage report action from 3693514

@amcaplan amcaplan force-pushed the no-color-fix branch 2 times, most recently from ed0047f to 2793fa7 Compare January 16, 2025 22:14
Copy link
Contributor

@graygilmore graygilmore left a comment

Choose a reason for hiding this comment

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

Other than the eslint errors that need fixing this looks good!

Certain versions of node add colors to console.warn and console.error
which doesn't respect our control of colors via chalk. To avoid this
kind of interference with the CLI, we should write directly to output
streams.
@amcaplan amcaplan merged commit 5159ef6 into main Jan 19, 2025
27 checks passed
@amcaplan amcaplan deleted the no-color-fix branch January 19, 2025 11:32
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.

3 participants