react-native-dotenv
Advanced tools
Comparing version 2.5.3 to 2.5.4
{ | ||
"name": "react-native-dotenv", | ||
"version": "2.5.3", | ||
"version": "2.5.4", | ||
"description": "Load environment variables using import statements.", | ||
@@ -24,3 +24,3 @@ "repository": "github:goatandsheep/react-native-dotenv", | ||
"devDependencies": { | ||
"@babel/core": "7.12.13", | ||
"@babel/core": "7.13.1", | ||
"codecov": "^3.8.1", | ||
@@ -27,0 +27,0 @@ "jest": "26.6.3", |
@@ -148,3 +148,3 @@ # react-native-dotenv [![CircleCI](https://circleci.com/gh/goatandsheep/react-native-dotenv.svg?style=svg)](https://circleci.com/gh/goatandsheep/react-native-dotenv) | ||
Note: it is not recommended that you commit any sensitive information in `.env` file to code in case your git repo is exposed. The best practice is to put a `.env.template` or `.env.development.template` that contains dummy values so other developers know what to configure. Then add your `.env` and `.env.development` to `.gitignore`. In a future release you can keep sensitive keys in a separate `.env.local` (and respective `.env.local.template`) in `.gitignore` and you can use your other `.env` files for non-sensitive config. | ||
Note: it is not recommended that you commit any sensitive information in `.env` file to code in case your git repo is exposed. The best practice is to put a `.env.template` or `.env.development.template` that contains dummy values so other developers know what to configure. Then add your `.env` and `.env.development` to `.gitignore`. You can also keep sensitive keys in a separate `.env.local` (and respective `.env.local.template`) in `.gitignore` and you can use your other `.env` files for non-sensitive config. | ||
@@ -171,2 +171,32 @@ The base set of variables will be `.env` and the environment-specific variables will overwrite them. | ||
### Option 1: easy mode | ||
Install the @types package [![npm version](https://badgen.net/npm/v/@types/react-native-dotenv)](https://www.npmjs.com/package/@types/react-native-dotenv) | ||
```shell | ||
npm install @types/react-native-dotenv | ||
``` | ||
Set the `moduleName` in your Babel config as `react-native-dotenv`. | ||
```json | ||
{ | ||
"plugins": [ | ||
["module:react-native-dotenv", { | ||
"moduleName": "react-native-dotenv" | ||
}] | ||
] | ||
} | ||
``` | ||
Import your variables from `react-native-dotenv`: | ||
```js | ||
import {API_URL} from 'react-native-dotenv' | ||
console.log(API_URL) | ||
``` | ||
### Option 2: specify types manually | ||
- Create a `types` folder in your project | ||
@@ -173,0 +203,0 @@ - Inside that folder, create a `*.d.ts`file, say, `env.d.ts` |
Sorry, the diff of this file is not supported yet
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
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
30886
73
272