From e8738da1fd6ef16aa81212f14b2e7323f92b72de Mon Sep 17 00:00:00 2001 From: Rafael Poveda Date: Tue, 9 Jan 2018 08:35:59 -0300 Subject: [PATCH 1/4] add support to set REACT_EDITOR to none --- packages/react-dev-utils/launchEditor.js | 5 +++++ packages/react-scripts/template/README.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index ba16827e644..47bea628589 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -257,6 +257,11 @@ function launchEditor(fileName, lineNumber) { } let [editor, ...args] = guessEditor(); + + if (editor.toLowerCase() === 'none') { + return; + } + if (!editor) { printInstructions(fileName, null); return; diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 55f5ae187aa..9f58f3e7606 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -2239,7 +2239,7 @@ PORT | :white_check_mark: | :x: | By default, the development web server will at HTTPS | :white_check_mark: | :x: | When set to `true`, Create React App will run the development server in `https` mode. PUBLIC_URL | :x: | :white_check_mark: | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application. CI | :large_orange_diamond: | :white_check_mark: | When set to `true`, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default. -REACT_EDITOR | :white_check_mark: | :x: | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebookincubator/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable points to your editor’s bin folder. +REACT_EDITOR | :white_check_mark: | :x: | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebookincubator/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. You can also set it to `none` to disable it. If you do it, make sure your systems [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable points to your editor’s bin folder. CHOKIDAR_USEPOLLING | :white_check_mark: | :x: | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. GENERATE_SOURCEMAP | :x: | :white_check_mark: | When set to `false`, source maps are not generated for a production build. This solves OOM issues on some smaller machines. From ed49529f54ec93787c38e3393c033cc5501aba2d Mon Sep 17 00:00:00 2001 From: Rafael Poveda Date: Tue, 9 Jan 2018 08:38:46 -0300 Subject: [PATCH 2/4] change README message --- packages/react-scripts/template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 9f58f3e7606..e2c5f40174f 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -2239,7 +2239,7 @@ PORT | :white_check_mark: | :x: | By default, the development web server will at HTTPS | :white_check_mark: | :x: | When set to `true`, Create React App will run the development server in `https` mode. PUBLIC_URL | :x: | :white_check_mark: | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application. CI | :large_orange_diamond: | :white_check_mark: | When set to `true`, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default. -REACT_EDITOR | :white_check_mark: | :x: | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebookincubator/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. You can also set it to `none` to disable it. If you do it, make sure your systems [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable points to your editor’s bin folder. +REACT_EDITOR | :white_check_mark: | :x: | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebookincubator/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely. CHOKIDAR_USEPOLLING | :white_check_mark: | :x: | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. GENERATE_SOURCEMAP | :x: | :white_check_mark: | When set to `false`, source maps are not generated for a production build. This solves OOM issues on some smaller machines. From fc5c10b284d3fde12afab84dcee12da79029bbc6 Mon Sep 17 00:00:00 2001 From: Rafael Poveda Date: Tue, 9 Jan 2018 08:58:26 -0300 Subject: [PATCH 3/4] change condition to avoid problems with editor being null --- packages/react-dev-utils/launchEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index 47bea628589..975b1435848 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -258,7 +258,7 @@ function launchEditor(fileName, lineNumber) { let [editor, ...args] = guessEditor(); - if (editor.toLowerCase() === 'none') { + if (editor && editor.toLowerCase() === 'none') { return; } From eb64aca72a30619187b509437d0c7fa29f638ff9 Mon Sep 17 00:00:00 2001 From: Rafael Poveda Date: Tue, 9 Jan 2018 09:15:57 -0300 Subject: [PATCH 4/4] move condition to avoid extra code --- packages/react-dev-utils/launchEditor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index 975b1435848..7c2e715da0a 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -258,12 +258,12 @@ function launchEditor(fileName, lineNumber) { let [editor, ...args] = guessEditor(); - if (editor && editor.toLowerCase() === 'none') { + if (!editor) { + printInstructions(fileName, null); return; } - if (!editor) { - printInstructions(fileName, null); + if (editor.toLowerCase() === 'none') { return; }