dotenv-load
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -6,2 +6,2 @@ #!/usr/bin/env node | ||
const result = shell.exec(process.argv.slice(2).join(' ')); | ||
process.exit(result.code) | ||
process.exit(result.code); |
15
index.js
@@ -32,15 +32,16 @@ const path = require('path'); | ||
const files = []; | ||
if(preloadEnv) { | ||
if (preloadEnv) { | ||
files.push(`${dotenvPath}.${preloadEnv}`); | ||
} | ||
return files.concat(dotenvFiles).forEach(dotenvFile => { | ||
return files.concat(dotenvFiles).forEach((dotenvFile) => { | ||
if (fs.existsSync(dotenvFile)) { | ||
require('dotenv-expand')( | ||
require('dotenv').config({ | ||
const dotenv = require('dotenv'); | ||
const dotenvExpand = require('dotenv-expand'); | ||
dotenvExpand.expand( | ||
dotenv.config({ | ||
path: dotenvFile, | ||
}) | ||
}), | ||
); | ||
} | ||
}) | ||
}); | ||
}; |
{ | ||
"name": "dotenv-load", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Load environment variables from .env, .env.local, .env.production, etc. when running a npm or yarn command", | ||
@@ -18,2 +18,3 @@ "author": "Martin Rädlinger", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"bin": { | ||
@@ -26,9 +27,9 @@ "dotenv-load": "cli.js" | ||
"dependencies": { | ||
"dotenv": "^5.0.0", | ||
"dotenv-expand": "^4.2.0", | ||
"shelljs": "^0.8.1" | ||
"dotenv": "^16.0.0", | ||
"dotenv-expand": "^8.0.2", | ||
"shelljs": "^0.8.5" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^1.11.1" | ||
"prettier": "^2.6.0" | ||
} | ||
} |
@@ -37,3 +37,3 @@ # dotenv-load [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
``` | ||
```txt | ||
.env.local | ||
@@ -53,1 +53,12 @@ .env.development.local | ||
- `.env.development.local`, `.env.test.local`, `.env.production.local` - Local overrides of environment-specific settings. | ||
## How can I use custom env file? | ||
You can pass a string to `dotenvLoad` function, but your file should have a name like `.env.YOUR_CUSTOM_NAME`, for example: `.env.default`. | ||
Then you can initialize it as follows: | ||
```js | ||
dotenvLoad() # will initialize standard names | ||
dotenvLoad('default') # will initialize your `.env.default` (while not overwriting defined vars above) | ||
``` |
47
63
4414
+ Addeddotenv@16.4.7(transitive)
+ Addeddotenv-expand@8.0.3(transitive)
- Removeddotenv@5.0.1(transitive)
- Removeddotenv-expand@4.2.0(transitive)
Updateddotenv@^16.0.0
Updateddotenv-expand@^8.0.2
Updatedshelljs@^0.8.5