Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Conversation

leahneukirchen
Copy link
Contributor

This makes npm follow the NO_COLOR standard, as explained in
http://no-color.org/

All command-line software which outputs text with ANSI color added
should check for the presence of a NO_COLOR environment variable that,
when present (regardless of its value), prevents the addition of ANSI
color.

npm already provides environment variables (npm_config_color=false) and
options (--no-color) to disable coloring by default, but NO_COLOR is an
comprehensive approach to disable colors for all tools.

@leahneukirchen leahneukirchen requested a review from a team as a code owner February 27, 2018 13:06
@@ -130,7 +130,7 @@ Object.defineProperty(exports, 'defaults', {get: function () {

cidr: null,

color: true,
color: typeof(process.env.NO_COLOR) === 'undefined',
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the error on CI, we might need to replace here with this: typeof process.env.NO_COLOR.

Refs: https://github.com/eslint/eslint/blob/master/docs/rules/no-extra-parens.md

Copy link
Contributor

Choose a reason for hiding this comment

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

This is better off as !process.env.NO_COLOR or, if you want NO_COLOR="" to be truthy, process.env.NO_COLOR != null (with one =)

Copy link
Contributor

@zkat zkat left a comment

Choose a reason for hiding this comment

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

I'm 👍 on this after a couple of review edits. Thanks for proposing this!

@@ -130,7 +130,7 @@ Object.defineProperty(exports, 'defaults', {get: function () {

cidr: null,

color: true,
color: typeof(process.env.NO_COLOR) === 'undefined',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is better off as !process.env.NO_COLOR or, if you want NO_COLOR="" to be truthy, process.env.NO_COLOR != null (with one =)

@@ -278,7 +278,7 @@ This is a list of CIDR address to be used when configuring limited access tokens

### color

* Default: true
* Default: true, unless the environment variable `NO_COLOR` is set
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this. Please mention NO_COLOR in the description below, instead, and how to use it. I'd rather keep this describing what the "no action" default is.

This makes npm follow the NO_COLOR standard, as explained in
http://no-color.org/

> All command-line software which outputs text with ANSI color added
> should check for the presence of a NO_COLOR environment variable that,
> when present (regardless of its value), prevents the addition of ANSI
> color.

npm already provides environment variables (npm_config_color=false) and
options (--no-color) to disable coloring by default, but NO_COLOR is an
comprehensive approach to disable colors for all tools.
Copy link
Contributor

@zkat zkat left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! This looks great, and I'll be including it in this week's release! 🎉

@zkat zkat changed the base branch from latest to release-next March 6, 2018 01:32
@zkat zkat merged commit 27ffca3 into npm:release-next Mar 8, 2018
zkat pushed a commit that referenced this pull request Mar 8, 2018
This makes npm follow the NO_COLOR standard, as explained in
http://no-color.org/

> All command-line software which outputs text with ANSI color added
> should check for the presence of a NO_COLOR environment variable that,
> when present (regardless of its value), prevents the addition of ANSI
> color.

npm already provides environment variables (npm_config_color=false) and
options (--no-color) to disable coloring by default, but NO_COLOR is an
comprehensive approach to disable colors for all tools.

PR-URL: #19929
Credit: @chneukirchen
Reviewed-By: @zkat
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants