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

Put yarn into silent mode when calling nested yarn run commands #3536

Merged
merged 1 commit into from
May 30, 2017

Conversation

sebmck
Copy link
Contributor

@sebmck sebmck commented May 30, 2017

Summary

This changes yarn run commands causing all child yarn processes to go into silent mode. This is useful as when you have a lot of nested scripts it can lead to a lot of stdout thrash with the yarn header CLI header and footer.

Before

yarn foo v0.26.0-0
$ echo foo && yarn bar
foo
yarn bar v0.24.3
$ echo bar
bar
✨  Done in 0.09s.
Done in 0.56s.

After

yarn foo v0.26.0-0
$ echo foo && yarn bar
foo
bar
Done in 0.56s.

Test plan

With a package.json of:

{
  "name": "yarn-silent-implicit",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "foo": "echo foo && yarn bar",
    "bar": "echo bar"
  }
}

produces the output of:

$ yarn foo
yarn foo v0.26.0-0
$ echo foo && yarn bar
foo
bar
Done in 0.56s.

Note that the the yarn bar call in the foo script does not include the yarn CLI header/footer.

@bestander bestander merged commit 76489f9 into master May 30, 2017
@sebmck sebmck deleted the implicit-silent branch May 30, 2017 17:56
@MalcolmDwyer
Copy link

MalcolmDwyer commented Jun 1, 2017

This looks cleaner, but one counterpoint to this change is that it was useful to see when you were accidentally invoking a different version of yarn.

For example, my CI build uses frontend-maven-plugin to to install its own version of yarn, and then runs my 'yarn package' script from package.json. Like your example, my 'yarn build' called other yarn commands, and I noticed that the secondary yarn calls were being run not with my CI-installed yarn, but instead the one installed globally on the machine.

I realize there are other ways of fixing and working around that issue, but having the versions show up in the logs helped me discover the problem.

If there's some way to ensure that the nested yarn call is using the same yarn executable as the parent call, then I would see no issue with this change.

I hope this is worth discussing... Thanks

@bestander
Copy link
Member

bestander commented Jun 1, 2017 via email

BYK pushed a commit that referenced this pull request Jun 30, 2017
**Summary**

Fixes #3536. Explicitly and programmatically passes `YARN_SILENT=0`
to test runs that checks yarn's output.

**Test plan**

All CI tests and local test runs with yarn 0.27.3 should pass.
BYK pushed a commit that referenced this pull request Jun 30, 2017
**Summary**

Fixes #3536. Explicitly and programmatically passes `YARN_SILENT=0`
to test runs that checks yarn's output.

**Test plan**

All CI tests and local test runs with yarn 0.27.3 should pass.
bestander pushed a commit that referenced this pull request Jun 30, 2017
**Summary**

Fixes #3536. Explicitly and programmatically passes `YARN_SILENT=0`
to test runs that checks yarn's output.

**Test plan**

All CI tests and local test runs with yarn 0.27.3 should pass.
bestander pushed a commit that referenced this pull request Jun 30, 2017
**Summary**

Fixes #3536. Explicitly and programmatically passes `YARN_SILENT=0`
to test runs that checks yarn's output.

**Test plan**

All CI tests and local test runs with yarn 0.27.3 should pass.
@edmorley
Copy link
Contributor

edmorley commented Oct 3, 2017

Hi!

Unfortunately this has broken a number of workflows (#3671, #4423, #3767, guigrpa/oao#50), and as such I think we should consider reverting it for now, and later replacing it with a solution that suppresses just the header/footer output (ie versions and timing info) rather than the entire command output. For that I've opened #4615.

Nothing's ever straight-forwards is it! :-)

@bestander
Copy link
Member

Thanks for raising, commenting in the new issue

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.

4 participants