-
-
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
[Feature] Flag to suppress ➤ YN0000:
output in yarn workspaces foreach
#2517
Comments
I don't remember why the prefix is printed (perhaps @deini remembers?), so it's at least a sign it should be investigated. From a quick look it seems to be because we sometimes can reach states where errors are thrown. Still, it's a fringe case and I could be swayed into replacing |
If I recall correctly, we were trying to be consistent and use |
Imo it makes most sense to be consistent with the regular commands, so when the non-foreach version of a command would log raw output, the foreach should too, and when the non-foreach version of a command would log via I thought changing the logging format of That doesn't quite answer the question of how to handle errors thrown specifically out of the |
I wouldn't be against removing YN**** from all output. It's hard to imagine it being useful for the vast majority of standard commands and use cases. |
It won't be removed from the rest of the commands (except perhaps on a case-by-case basis), but for
It already does, but the prefix is added twice: one for foreach, and one for the command itself. The foreach prefix really has no useful purpose I can see. |
Just to add, here's another value from having the option to suppress it. The [TSC]
[TSC] 1:55:43 PM - Starting compilation in watch mode...
[TSC]
[TSC]
[TSC] 1:55:44 PM - Found 0 errors. Watching for file changes.
[WS] ➤ YN0000: [@app/server]: [nodemon] 2.0.7
[WS] ➤ YN0000: [@app/server]: [nodemon] to restart at any time, enter `rs`
[WS] ➤ YN0000: [@app/server]: [nodemon] watching path(s): dist/**/*.js
[WS] ➤ YN0000: [@app/server]: [nodemon] watching extensions: js,mjs,json
[WS] ➤ YN0000: [@app/server]: [nodemon] starting `node dist/index.js`
[WS] ➤ YN0000: [@app/client]: ready - started server on 0.0.0.0:3000, url: http://localhost:3000
[WS] ➤ YN0000: [@app/client]: info - Using webpack 4. Reason: future.webpack5 option not enabled https://nextjs.org/docs/messages/webpack5
[WS] ➤ YN0000: [@app/server]: started server on http://localhost:3001
[WS] ➤ YN0000: [@app/client]: event - compiled successfully
|
Alright friends. In the meantime i have a very non-optimal solution. First, make sure you run Next you need to pipe the output into the cut command. For example:
This will trim the first 31 columns, which is to say that is how many characters there are making up the string '➤ YN0000: ' when you have colour enabled. After that, your output should now be missing the annoying code. Yarn, please remove this or add an option to suppress this. It looks really ugly in my companies CI pipeline and is a super hacky solution. |
As mentioned in my last post, we accept PRs on this 😉 |
Would you consider making the messages showing dependent on the enableMessageNames an adequate change then? If so, I'll make a pr in the next while to address the issue. |
Actually, after setting the appropriate enableMessageNames to false, the foreach no longer shows this. This can be closed now as far as i can tell. |
Would love to see a flag for |
Even though we may not ultimately use it: - It seems to be a project in the midst of a philosophical problem. - Why give it another name, unless losing track of where it came from - It seems to decouple architecture (yay) but I'm concerned with not adopting an incremental approach to make yarn v1 better. Why not decouple yarn v1. Slowly improve that one. - 99% of the options berry has make no sense to me. Overwhelmed by choices. Every configuration option is listed, with no help given to making the bread and butter scenarios prominent. My guess is the settings are to fill niche caches and specialized project layouts. What would help: Show practical examples of what type of projects these configuration settings are for. If it's not fitting the scenario - don't even mention it. - Not a fan of how YN0000 shows everywhere. yarnpkg/berry#2517 since Feb 25, 2021 This may have a practical use case for it, e.g. when certain operations run in parallel. But this shows even when an operation isn't parallel. Eek. - The underlying feeling I have is berry is optimizing for the maintainers, and the user is an afterthought. This is direct opposite to what yarn is about. Yarn is about hiding complexity, user convenience and happiness, and performance. As odd as that may sound - it's important to strike a balance of a good product and a good developer experience. - I still see a lot of potential and benefit in berry As an open source maintainer The architecture is there, it just needs to get polished to show what matters to the user, to convey its value.
Even though we may not ultimately use it: - It seems to be a project in the midst of a philosophical problem. - Why give it another name, unless losing track of where it came from - It seems to decouple architecture (yay) but I'm concerned with not adopting an incremental approach to make yarn v1 better. Why not decouple yarn v1. Slowly improve that one. - 99% of the options berry has make no sense to me. Overwhelmed by choices. Every configuration option is listed, with no help given to making the bread and butter scenarios prominent. My guess is the settings are to fill niche caches and specialized project layouts. What would help: Show practical examples of what type of projects these configuration settings are for. If it's not fitting the scenario - don't even mention it. - Not a fan of how YN0000 shows everywhere. yarnpkg/berry#2517 since Feb 25, 2021 This may have a practical use case for it, e.g. when certain operations run in parallel. But this shows even when an operation isn't parallel. Eek. - The underlying feeling I have is berry is optimizing for the maintainers, and the user is an afterthought. This is direct opposite to what yarn is about. Yarn is about hiding complexity, user convenience and happiness, and performance. As odd as that may sound - it's important to strike a balance of a good product and a good developer experience. - I still see a lot of potential and benefit in berry As an open source maintainer The architecture is there, it just needs to get polished to show what matters to the user, to convey its value.
Even though we may not ultimately use it: - It seems to be a project in the midst of a philosophical problem. - Why give it another name, unless losing track of where it came from - It seems to decouple architecture (yay) but I'm concerned with not adopting an incremental approach to make yarn v1 better. Why not decouple yarn v1. Slowly improve that one. - 99% of the options berry has make no sense to me. Overwhelmed by choices. Every configuration option is listed, with no help given to making the bread and butter scenarios prominent. My guess is the settings are to fill niché cases and specialized project layouts. What would help: Show practical examples of what type of projects these configuration settings are for. If it's not fitting the scenario - don't even mention it. - Not a fan of how YN0000 shows everywhere. yarnpkg/berry#2517 since Feb 25, 2021 This may have a practical use case for it, e.g. when certain operations run in parallel. But this shows even when an operation isn't parallel. Eek. - The underlying feeling I have is berry is optimizing for the maintainers, and the user is an afterthought. This is direct opposite to what yarn is about. Yarn is about hiding complexity, user convenience and happiness, and performance. As odd as that may sound - it's important to strike a balance of a good product and a good developer experience. - I still see a lot of potential and benefit in berry As an open source maintainer The architecture is there, it just needs to get polished to show what matters to the user, to convey its value.
I would vote against closing this issue, as even with For now I'm able to use |
Should enableMessageNames=false simply stop printing the arrow? |
That seems like a reasonable approach, too. I honestly feel like the default should be to omit the arrow and YN0000 prefix. Vanilla |
Actually, re-reading the scrollback it seems like @arcanis agrees with me that the |
I have started a PR to address this over at #5152. I'd love if a maintainer can take a look at that diff (it's very short, 15 lines of code) and let me know how they feel about the general approach taken; then I will set about updating the test suite. |
Describe the user story
Context: I have a Typescript project with many interdependent workspaces, most of which are libraries for a handful of applications. In CI, I use the following command to build any particular app with all its workspace dependencies:
Each workspace's
build
script callstsc
with some flags.I use GitHub Actions as my CI with the https://github.com/actions/setup-node action to configure my CI environment for building my project. That setup step by default includes a tsc problem matcher which uses regex to match the output of the Typescript compiler and annotate the code in a PR with the actual errors.
If my CI runs
yarn run build
on a workspace directly, the output is identical to the output oftsc
, so the matcher works fine. However, since I useyarn workspaces foreach
, the output gets prefixed with Yarn's log level codes, causing the problem matcher to not match the output correctly. In particular, it breaks on matching the file name, causing the annotation to end up in the wrong place.Describe the solution you'd like
I think
yarn workspaces foreach
should have a flag to suppress stuff like➤ YN0000:
from the output, or in other words a flag to get the raw unmodified output of the command(s) being run:I'd be willing to work on this PR if it's something that would be accepted.
Describe the drawbacks of your solution
Just the general drawback of having yet another flag/feature to maintain/test.
I don't think there are any specific drawbacks to this feature in particular, but I'm unfamiliar with Yarn's codebase so I likely have blind spots here.
Describe alternatives you've considered
This could be solved by modifying the regex in the problem matcher, but I believe it's out of scope for a
tsc
problem matcher to account for all kinds of wrappers that might be mutating the compiler's error format.This could also be worked around by piping the output through another command that removes that prefix from the output, but my intuition is that'd be prone to failure. I imagine parsing the output of CLI tools in some way is a common enough use case that Yarn should have the flag to allow it without strange workarounds.
The text was updated successfully, but these errors were encountered: