Yarn: How can I disable emojis output by default ?

Created on 18 Jun 2017  路  12Comments  路  Source: yarnpkg/yarn

I am using:
macOS Sierra 10.12.5
node v8.1.2
yarn v0.24.5

When I pass '--no-emoji' flag to a command explicitly, it works.
image

Then I tried config a default setting to my global .yarnrc file.
image

But it doesn't works.
image

So how can I disable emojis output by default setting ?

cat-bug good first issue help wanted triaged

Most helpful comment

Looks like a missing feature to me: yarn config set emoji false

Would you be interested in adding this in a PR?

All 12 comments

Perform an IoC on the CLI and pass flags every time.

you could do alias yarn="yarn --no-emoji" in your .profile/.bashrc/.zshrc

Or you can add --no-emoji true (or --emoji false) to your .yarnrc file.

@arcanis on old yarn version this will fail https://github.com/yarnpkg/yarn/issues/2009#issuecomment-327184993

@FDiskas we don't support this on older versions of yarn.

Newest version (Stable: v1.0.1) on windows looks like same error :o:
package.json

  "scripts": {
      "start": "webpack --watch"
  },

and then i run

yarn start

the output is

yarn start v1.0.1
error No command specified.
info Commands available from binary scripts: acorn, acorn.cmd, errno, errno.cmd, json5, json5.cmd, loose-envify, loose-envify.cmd, miller-rabin, miller-rabin.cmd, mkdirp, mkdirp.cmd,
semver, semver.cmd, sha.js, sha.js.cmd, tsc, tsc.cmd, tsserver, tsserver.cmd, uglifyjs, uglifyjs.cmd, webpack, webpack.cmd, which, which.cmd
info Project commands
   - start
      webpack --watch
question Which command would you like to run?:

And if I remove the --emoji true from .yarnrc file everything works fine.
And I can't install packages like

yarn add awesome-typescript-loader -D

Got an error

error Missing list of packages to add to your project.

Looks like a missing feature to me: yarn config set emoji false

Would you be interested in adding this in a PR?

For me it would be cool

If anyone is interested in a PR, I'd be more than happy to support the effort.

@BYK looks related to #4457

EDIT: Looked at this more while @BrooklyJS. Found some interesting issue, i.e. precedence of settings.

Scenarios found:

  • user doesn't set emoji on cmd line.
  • user sets on cmd line
  • user sets on cmd line and in yarn config
    ...
    I think the possible combinations is somewhere around 3^3*

Given that, @BYK what precedence should be preferred:

  1. cmd line
  2. local yarn config
  3. global yarn config

?

cc @courajs

@olingern thanks for pairing and showing me some yarn internals!

I think that precedence looks right.

There's one main hard part to this feature. The Reporter is what needs to know whether to show emoji or not, but it's instantiated before configuration is loaded (here), and actually is required for instantiating the Config object.
So we probably need to a) decouple these more somehow, b) do some state wrangling to update the reporter with emoji info after it's created, or c) read config info via some other mechanism for this option only.

There's also a small wrinkle in that right now commander is defaulting the emoji flag to true, unless --emoji false or --no-emoji are passed - we can't tell just from commander.emoji whether the user passed --emoji true or didn't specify the flag at all. I think it's pretty important to use the flag if it's passed, but fall back to config if not specified.

This should be fine on master now (latest nightlies or v1.1.0). Commander is pretty tricky so right now the "proper" way to do this is to pass --emoji false or --emoji 0 either on the command line or in .yarnrc.

Was this page helpful?
0 / 5 - 0 ratings