-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(workspace-tools): remove message prefix from workspaces foreach
#5152
fix(workspace-tools): remove message prefix from workspaces foreach
#5152
Conversation
➤ YN0000:
output in yarn workspaces foreach
➤ YN0000:
output in yarn workspaces foreach
➤ YN0000:
output in yarn workspaces foreach
➤ YN0000:
prefix from workspaces foreach
➤ YN0000:
prefix from workspaces foreach
workspaces foreach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #5152 (comment)
@merceyz alternatively your earlier suggestion to use a ThrowReport instead of a StreamReport seems like it could also work. Again, I'm not super familiar with this codebase so I'd be curious to know if there's a downside to swapping out StreamReport with ThrowReport within foreach that made you change your suggestion? |
After checking the code a bit more I saw that it was easier to modify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
includePrefix
should apply to all the methods that print a prefix, not just reportInfo
.
@merceyz PR updated - I went ahead and extracted the |
Thanks for the fix! |
…#5152) * remove caret * disable message names * add version bump * switch to includePrefix * add test, update test snapshots * apply includePrefix logic to all functions in StreamReport that write to the terminal * refactor: rename to `formatPrefix` and move `formatIndent` into it Co-authored-by: merceyz <[email protected]>
When it will be released? |
It was released in v3.4.0 |
What's the problem this PR addresses?
problem statement taken from #2517
Closes #2517
How did you fix it?
Based on @arcanis's comment, I chose to remove the
➤ YN0000:
prefix from theyarn workspaces foreach
stream reporter output entirely, by adding an additional flag to the StreamReport options to allow suppressing the➤
and message name.This aligns with the existing behavior of the analogous single-workspace
yarn exec
command, which is one of the few Yarn Berry commands that does not add any kind of prefixing/formatting on top of its output.Note that this is an unfamiliar codebase for me and I'm not sure if my code changes are the cleanest way of attaining the desired result here. I'm pushing this up without updating any of the tests yet to get feedback on this approach - very open to alternative suggestions.
This only applies to the outer layer of execution; if the
enableMessageNames
config option is set to true, the sub-executions ofyarn workspaces foreach
will still include theYNXXXX
output.Checklist