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

Prefix workspace commands with workspace name #6932

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

peterlebrun
Copy link

Fixes: #6389 (as discussed with @eps1lon/@arcanis, created a separate PR for this)

When running commands via yarn workspaces run foo, prefix command with bold and colorized workspace name. (This change was inspired in large part by lerna's implementation).

This provides much more clarity when working in a multi-workspace repo.

image

@buildsize
Copy link

buildsize bot commented Jan 16, 2019

File name Previous Size New Size Change
yarn-[version].noarch.rpm 1.11 MB 1.11 MB 5.19 KB (0%)
yarn-[version].js 4.47 MB 4.49 MB 16.94 KB (0%)
yarn-legacy-[version].js 4.66 MB 4.68 MB 16.96 KB (0%)
yarn-v[version].tar.gz 1.12 MB 1.12 MB 2.68 KB (0%)
yarn_[version]all.deb 815.78 KB 818.85 KB 3.07 KB (0%)

@peterlebrun peterlebrun force-pushed the yarn-workspaces-prefix branch 2 times, most recently from f1f2a31 to 144f115 Compare January 16, 2019 21:59
@arcanis
Copy link
Member

arcanis commented Jan 23, 2019

Looks really nice, but it still has the problem that it's BC-breaking. People relying on this command output will have their scripts broken:

yarn workspaces run exec -s pwd

@sgronblo
Copy link

Can't it just be put behind a command line flag so that the people who want this can enable it and the people who have a working build configuration won't have that be broken?

yarn workspaces --prefixed run build for example?

@peterlebrun
Copy link
Author

@arcanis would @sgronblo's suggestion to hide this via CLI flag be considered? If so I'm happy to do the work.

Thanks!

@arcanis
Copy link
Member

arcanis commented Feb 5, 2019

I'm not sure how feasible it is with the CLI - but if it works, I'm ok with it.

Another option would be to wait for the v2, since making breaking changes of this kind will be perfectly fine then. What do you think?

@TerribleDev
Copy link

@arcanis flag in v1, default in v2?

@arcanis
Copy link
Member

arcanis commented Mar 14, 2019

Yup, I'm fine with that 🙂

If a CLI flag is too hard to implement, I'd also be open to use a yarnrc flag for it (like enable-contextual-output or similar).

// Stay consistent by using the key that is mapped to proc
if (!workspaceColors[key]) {
const randInt = Math.floor(Math.random() * colors.length);
workspaceColors[key] = colors[randInt];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason not to just go through the colors array in order here?
It seems like by using rand we could potentially pick the same color for neighboring workspaces.

Choose a reason for hiding this comment

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

I agree

Choose a reason for hiding this comment

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

by going through the array it will also make the output deterministic

@TerribleDev
Copy link

@arcanis ok so just to review, we will update this PR to include a flag in v1.

As far as V2 is concerned, how do we contribute to it? Or will you implement that side?

@arcanis
Copy link
Member

arcanis commented Mar 19, 2019

Awesome, thanks! 🙂

The v2 trunk is here: https://github.com/yarnpkg/berry - the contribution process is pretty much the same as here (in this case the command you're likely interested in would be workspaces foreach).

@sgronblo
Copy link

Is this PR abandoned? This feature would be nice to have.

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.

prefix "yarn workspaces run" (v1.10.0) output with package names
5 participants