Skip to content

Use env variable to disable clearConsole (#2495)#3288

Closed
lumio wants to merge 6 commits into
react:masterfrom
lumio:master
Closed

Use env variable to disable clearConsole (#2495)#3288
lumio wants to merge 6 commits into
react:masterfrom
lumio:master

Conversation

@lumio
Copy link
Copy Markdown

@lumio lumio commented Oct 16, 2017

This PR allows disabling clearConsole by providing the env variable DEBUG (suggested here and here).

How this works?

create-react-app my-app
cd my-app
DEBUG=1 yarn start
# or: DEBUG=1 npm start

@facebook-github-bot
Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@react-scripts-dangerous
Copy link
Copy Markdown

Hello! I'm a bot that helps facilitate testing pull requests.

Your pull request (commit bf995a8) has been released on npm for testing purposes.

npm i react-scripts-dangerous@1.0.15-bf995a8.0
# or
yarn add react-scripts-dangerous@1.0.15-bf995a8.0
# or
create-react-app --scripts-version=react-scripts-dangerous@1.0.15-bf995a8.0 folder/

Note that the package has not been reviewed or vetted by the maintainers. Only install it at your own risk!

Thanks for your contribution!

Copy link
Copy Markdown
Contributor

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

There's no need to start it with REACT_APP_ because you aren't going to read it from your app.

I'm hesitant to add an extra variable just for this. Are there more similar things people who want this usually want? Or maybe there's some existing conventional env variable other tools already use for this?

@lumio
Copy link
Copy Markdown
Author

lumio commented Oct 29, 2017

@gaearon sounds legit.
Usually it is meant for a more verbose output so I would suggest to rename it to DEBUG or VERBOSE

@mgmeyers
Copy link
Copy Markdown

Using the name DEBUG seems very generic for a very specific task: disabling this package's console clearing functionality. And, not that it's the job of this package to play nicely with others, using DEBUG would conflict with the popular debug package.

It would be ideal to be able to disable this functionality without any side effects, in which case using a prefix like REACT_APP_ would make sense. Something like REACT_APP_PRESERVE_CONSOLE is pretty verbose (I'm sure there's a shorter name), but also very specific and intentional.

@lumio
Copy link
Copy Markdown
Author

lumio commented Jan 12, 2018

It doesn’t really need to be a short name as it probably will be set only within package.json.

And obviously this is just a minor behavioral change. I wouldn’t overthink it too much.

I personally don’t mind both suggestions. What I’d suggest is setting up a more generic variable with a REACT_APP_ prefix. Like REACT_APP_VERBOSE. That way similar behavioural changes can make use of the same env variable. It is clear what was intended, yet generic enough so others might use it for their own changes.

What do you think?

@mgmeyers
Copy link
Copy Markdown

Sounds reasonable! 👍

lumio added 3 commits January 14, 2018 18:11
As discussed in the PR (#3288), it might be better to be a little bit more
specific, yet generic enough so others might use this env variable for
their own features.
@viankakrisna
Copy link
Copy Markdown
Contributor

there is a way to achieve the same functionality for people that wanted this right now, #2495 (comment)

@angusfretwell
Copy link
Copy Markdown

Environment variables prefixed with REACT_APP_ can be embedded during build time, so the variable name probably shouldn't use that prefix. Also note that none of the other configuration variables use the prefix.

@ghost
Copy link
Copy Markdown

ghost commented Apr 10, 2018

Any news on this?

Please can we add REACT_APP_NO_CLEAR_CONSOLE env var. Using Windows, OSX, Linux is a nightmare!

@lumio
Copy link
Copy Markdown
Author

lumio commented Apr 10, 2018

You can do the following trick: #2495 (comment)
Not sure about Windows though

@stale
Copy link
Copy Markdown

stale Bot commented Nov 2, 2018

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

@stale stale Bot added the stale label Nov 2, 2018
@stale
Copy link
Copy Markdown

stale Bot commented Nov 7, 2018

This pull request has been automatically closed because it has not had any recent activity. The conversation will be locked in 7 days unless the pull request is reopened. Thank you for your contribution.

@stale stale Bot closed this Nov 7, 2018
@lock lock Bot locked and limited conversation to collaborators Jan 18, 2019
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.

8 participants