Socket
Socket
Sign inDemoInstall

react-native-dotenv

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-dotenv - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

__tests__/__fixtures__/multi-env/.env.test

10

__tests__/index.test.js
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')

8

index.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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc