gradle-node-plugin
gradle-node-plugin copied to clipboard
No colors in yarn tasks output
When running Yarn tasks using this gradle plugin, I get no colors in the output. Running the same commands using Yarn directly prints colorized text.
e.g:
./gradlew yarn_list
: all text is white
vs.
yarn list
: text is white and gray
Any update on this yet?
I'm running into this as well. Is there a way to enable colored output?
@mroloux this plugin hasn't seen active development in a long while, there's however a maintained fork available.
But I also have a feeling that this wasn't an issue on Linux and with npm, so more information is probably required to solve this
@deepy Thanks!
I assume this is the fork you're referring to? https://github.com/node-gradle/gradle-node-plugin
Seems like it has the same issue - no colored output. Guess we'll have to live without it then ;-)
That's the one yeah, though for coloured output there might be a way to force yarn/npm to do coloured output.
You could try adding --color=full
into args and see if that helps.
Something like:
tasks.named('yarn_list').configure { args += '--color=full' }
When I execute yarn run tsc
(outside of Gradle), the colors are printed just fine. So it must be related to how Gradle handles the output of yarn.
I've tried add --color=full
, but that doesn't seem to be a supported parameter.
Also tried --console=rich
, but that didn't make a difference.
Thanks for the help!
This issue has some variations that might be worth trying https://github.com/yarnpkg/yarn/issues/5733
Yes, FORCE_COLOR=true
did the trick! Thanks so much!
I also added the --pretty
flag to the tsc
command, to get nicely colored errors from TypeScript. And --colors
to prettify Jest.
Who would have known that Yarn, tsc and Jest would behave so differently within Gradle 🤔
Most tools do when the output isn't a tty, you can simulate it by doing yarn install | cat
, but I'm glad you managed to get it working :-)