react-native/local-cli
Valeri Karpov 402e7eaac2 Don't clobber user-defined environment variables
Summary:
Re: javache 's suggestions from https://github.com/facebook/react-native/pull/7878. Didn't want to deal with the merge conflict so I'm opening a separate PR. Here's the original justification:

If I want to set NODE_ENV to "baconator", I should be allowed to. Mutating global state that most devs assume to be immutable is just abysmal dev practice, especially since this mutation only happens when you're building for prod, not running on the simulator.

To test this, run env NODE_ENV=baconator ./gradlew assembleRelease with babel-plugin-transform-inline-environment-variables in your app/.babelrc. You'll see that the final app has NODE_ENV=production.

As a side note, running with babel-plugin-transform-inline-environment-variables in the top-level .babelrc crashes horribly with a compiler error.

For anybody who runs into this bug and doesn't feel like waiting for this to get merged, I wrote a quick babel plugin to remove assignments to process.env, which is sufficient to fix this issue.
Closes https://github.com/facebook/react-native/pull/8057

Differential Revision: D3419950

Pulled By: javache

fbshipit-source-id: dc541cad0a99906433e5c14bbc93ce66b4ed325e
2016-06-10 15:28:29 -07:00
..
__mocks__ Fix more tests 2015-09-16 13:05:30 -07:00
__tests__ Temporarily disable cli tests 2015-11-12 07:05:01 -08:00
bundle Don't clobber user-defined environment variables 2016-06-10 15:28:29 -07:00
dependencies Packager: accept relative --transformer paths everywhere. 2016-06-06 17:58:25 -07:00
generate Revert "Add folders to attempt to unblock sync" 2015-10-26 22:48:10 +00:00
generator Made react installed via reac-native init strict to unbreak 15.1.0 2016-06-03 03:43:31 -07:00
generator-android Add Fresco to ProGuard 2016-06-06 22:58:42 -07:00
generator-ios Link React library to Tests target 2016-06-03 21:43:22 -07:00
library Remove 'react-native link' 2016-04-29 05:27:28 -07:00
rnpm Fix typo (shoud -> should) 2016-06-04 16:43:41 -07:00
runAndroid Setting current working directory for dev server. 2016-05-04 02:45:29 -07:00
runIOS Make iOS project path configurable by parameter in run-ios cli command 2016-04-01 08:03:20 -07:00
server RN: Clear Debug Console on Reload JS 2016-06-08 19:13:25 -07:00
upgrade Fix comment typos 2016-06-03 02:43:57 -07:00
util Fix comment typos 2016-06-03 02:43:57 -07:00
version Add `--version` to `local-cli/cli.js` 2016-04-29 09:25:32 -07:00
cli.js Use a separate babel config for the local-cli and the packager 2016-05-21 06:58:26 -07:00
cliEntry.js react-native link calls into rnpm 2016-06-03 09:13:20 -07:00
default.config.js react app root path can be override by env var 'react_native_app_root' 2016-04-07 07:39:22 -07:00
generate-android.js Add license headers to local-cli 2015-10-20 09:55:21 -07:00
generator-utils.js flowconfig adds flow/ folder 2016-03-21 06:26:34 -07:00
setup_env.bat Fix comments on .bat file 2015-10-28 21:36:07 -04:00
setup_env.sh Change ulimit to 2048 for non root Mac users 2016-02-06 11:45:37 -08:00
wrong-react-native.js Fix usage of react-native cli inside package.json scripts 2016-04-26 15:42:35 -07:00