react-native-dotenv
Advanced tools
Comparing version 2.4.3 to 2.5.0
@@ -108,2 +108,9 @@ const {transformFileSync} = require('@babel/core') | ||
}) | ||
it('should load APP_ENV specific env file', () => { | ||
process.env.APP_ENV = 'cli' | ||
const {code} = transformFileSync(FIXTURES + 'app-env/source.js') | ||
expect(code).toBe('console.log("abc123456");\nconsole.log("username123456");') | ||
}) | ||
}) |
@@ -35,3 +35,3 @@ const {readFileSync} = require('fs') | ||
const babelMode = process.env.BABEL_ENV || process.env.NODE_ENV || 'development' | ||
const babelMode = process.env.APP_ENV || process.env.BABEL_ENV || process.env.NODE_ENV || 'development' | ||
if (this.opts.safe) { | ||
@@ -38,0 +38,0 @@ const parsed = parseDotenvFile(this.opts.path, this.opts.verbose) |
{ | ||
"name": "react-native-dotenv", | ||
"version": "2.4.3", | ||
"version": "2.5.0", | ||
"description": "Load environment variables using import statements.", | ||
@@ -24,7 +24,7 @@ "repository": "github:goatandsheep/react-native-dotenv", | ||
"devDependencies": { | ||
"@babel/core": "7.12.9", | ||
"@babel/core": "7.12.10", | ||
"codecov": "^3.8.1", | ||
"jest": "26.6.3", | ||
"jest-junit": "^12.0.0", | ||
"xo": "^0.35.0" | ||
"xo": "^0.37.1" | ||
}, | ||
@@ -31,0 +31,0 @@ "author": "Kemal Ahmed", |
@@ -155,3 +155,16 @@ # react-native-dotenv [![CircleCI](https://circleci.com/gh/goatandsheep/react-native-dotenv.svg?style=svg)](https://circleci.com/gh/goatandsheep/react-native-dotenv) | ||
In general, **Release** is `production` and **Debug** is `development`. | ||
## Experimental feature | ||
One thing that we've noticed is that metro overwrites the test environment variable even if you specify a config so we've added a way to fix this. Make sure to specify the config value as indicated in the wiki and make custom configs for alternative builds. However, if you still need this, such as for a staging / test environment, you can add the APP_ENV environment variable in the CLI. For example: | ||
```json | ||
// package.json | ||
{ | ||
"scripts": { | ||
"start:staging": "APP_ENV=staging npx react-native start", | ||
} | ||
} | ||
``` | ||
The above example would use the `.env.staging` file. The standard word is `test`, but go nuts. | ||
### Reference Material | ||
@@ -158,0 +171,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26400
63
204
208
12