Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

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.4.3 to 2.5.0

__tests__/__fixtures__/app-env/.babelrc

7

__tests__/index.test.js

@@ -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");')
})
})

2

index.js

@@ -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 @@

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