react-native-dotenv
Advanced tools
Comparing version 2.3.0 to 2.4.0
const {transformFileSync} = require('@babel/core') | ||
const FIXTURES = '__tests__/__fixtures__/' | ||
const env = Object.apply({}, process.env) | ||
describe('react-native-dotenv', () => { | ||
const OLD_ENV = process.env | ||
afterEach(() => { | ||
process.env = Object.apply({}, env) | ||
jest.resetModules() | ||
process.env = {...OLD_ENV} | ||
}) | ||
@@ -53,2 +54,7 @@ | ||
it('should load multiple env files', () => { | ||
const {code} = transformFileSync(FIXTURES + 'multi-env/source.js') | ||
expect(code).toBe('console.log("abc123456");\nconsole.log("username123456");') | ||
}) | ||
it('should support `as alias` import syntax', () => { | ||
@@ -55,0 +61,0 @@ const {code} = transformFileSync(FIXTURES + 'as-alias/source.js') |
@@ -35,3 +35,3 @@ const {readFileSync} = require('fs') | ||
const babelMode = process.env.BABEL_ENV || 'development' | ||
const babelMode = process.env.BABEL_ENV || process.env.NODE_ENV || 'development' | ||
if (this.opts.safe) { | ||
@@ -43,8 +43,8 @@ const parsed = parseDotenvFile(this.opts.path, this.opts.verbose) | ||
dotenv.config({ | ||
path: this.opts.path | ||
}) | ||
dotenv.config({ | ||
path: this.opts.path + '.' + babelMode, | ||
silent: true | ||
}) | ||
dotenv.config({ | ||
path: this.opts.path | ||
}) | ||
this.env = process.env | ||
@@ -51,0 +51,0 @@ } |
{ | ||
"name": "react-native-dotenv", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Load environment variables using import statements.", | ||
@@ -5,0 +5,0 @@ "repository": "github:goatandsheep/react-native-dotenv", |
@@ -141,3 +141,3 @@ # react-native-dotenv [![CircleCI](https://circleci.com/gh/goatandsheep/react-native-dotenv.svg?style=svg)](https://circleci.com/gh/goatandsheep/react-native-dotenv) | ||
When `false` (default behavior), an error will be thrown. | ||
When set to `false`, an error will be thrown. **This is no longer default behavior**. | ||
@@ -144,0 +144,0 @@ ## Caveats |
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
20993
52
192
10