Sitelet https://web.archive.org/web/20220411050620/https://github.com/vercel/turborepo/issues/223
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

Support colored output from original CLI #223

Open
charkour opened this issue Dec 13, 2021 · 11 comments
Open

Support colored output from original CLI #223

charkour opened this issue Dec 13, 2021 · 11 comments
Assignees
Labels
good first issue story

Comments

@charkour
Copy link
Contributor

@charkour charkour commented Dec 13, 2021 •

Describe the feature you'd like to request

Show original CLI colors in the output.

Describe the solution you'd like

I would like to be able to have a --colors flag when running turbo to enable colors of the CLI output, including the output from the sub packages/apps. turbo would likely set the environment variable FORCE_COLOR=1 before running commands.

Describe alternatives you've considered

Manually setting the monorepo's environment variable to FORCE_COLOR=1. This enables color when packages, like Next.js, use the npm package chalk

@charkour
Copy link
Contributor Author

@charkour charkour commented Dec 13, 2021

I would be willing to make a PR for this if applicable. Thanks!

@jaredpalmer
Copy link
Collaborator

@jaredpalmer jaredpalmer commented Dec 13, 2021

Go for it.

@jaredpalmer
Copy link
Collaborator

@jaredpalmer jaredpalmer commented Dec 13, 2021 •

Start here:

func parseRunArgs(args []string, cwd string) (*RunOptions, error) {

and around here is where to set FORCE_COLOR:

envs := fmt.Sprintf("TURBO_HASH=%v", hash)

@charkour
Copy link
Contributor Author

@charkour charkour commented Dec 13, 2021

Thanks! I'll work on it tomorrow night.

@jaredpalmer jaredpalmer added story good first issue labels Dec 13, 2021
@jaredpalmer
Copy link
Collaborator

@jaredpalmer jaredpalmer commented Dec 13, 2021

@charkour Are you in the Discord? If not, join us!

@charkour
Copy link
Contributor Author

@charkour charkour commented Dec 13, 2021 •

Yes! Thank you. With a different profile picture.

@charkour
Copy link
Contributor Author

@charkour charkour commented Dec 14, 2021

I had a little time to try implementing this and found that the FORCE_COLOR environment variable needs to be set in the working directory where the command is executed (for example docs). Setting it after line 487 doesn't correctly force the color.

I'll work on this more tomorrow. Let me know if you have any ideas. Go is a new language to me.

@charkour
Copy link
Contributor Author

@charkour charkour commented Dec 16, 2021

I am making good progress on this.

@paul-vd
Copy link

@paul-vd paul-vd commented Jan 15, 2022 •

Is there any update on this? 🎅🎄🎁

@charkour
Copy link
Contributor Author

@charkour charkour commented Jan 15, 2022

If you're using node, you can set FORCE_COLOR=1 in your environment variables. The PR hasn't been reviewed.

@paul-vd
Copy link

@paul-vd paul-vd commented Feb 22, 2022 •

@charkour Yea that's what I'm currently using, but it seems like quite a dirty solution, For example, if you have 10 packages with each of them having roughly ~4 commands
image
This would mean that you need to make at least 40 changes to enable colors.

I think it would be much better to use --colors, or considering the comment in your PR, the flag could be something like --node-colors instead, and eventually a unified --colors flag depending on the decisions. but yea the feature in your PR would be most welcoming. That would avoid having to set the FORCE_COLOR=1 in ~40 different places 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue story
Projects
None yet
Development

No branches or pull requests

3 participants