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

dotenv-mono

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv-mono - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

14

package.json
{
"name": "dotenv-mono",
"version": "1.1.0",
"version": "1.1.1",
"main": "./dist/index.js",

@@ -15,3 +15,3 @@ "module": "./dist/index.js",

},
"homepage": "https://marcocesarato.github.io/dotenv/",
"homepage": "https://github.com/marcocesarato/dotenv",
"license": "GPL-3.0-or-later",

@@ -90,10 +90,12 @@ "scripts": {

"react",
"node",
"nodejs",
"node.js",
"angular",
".env",
".env.local",
".env.development",
".env.production"
".env.production",
"turbo",
"turborepo",
"shared",
"share"
]
}

@@ -38,3 +38,3 @@ <div align="center">

├── apps
│ ├── nextjs
│ ├── web
│ ├── docs

@@ -49,8 +49,11 @@ ```

Starting from the current process directory, this package finds the first file that matches the best particular filename criteria with the highest priority.
Starting from the current process directory, this package finds the first file that matches the best filepath and filename criteria with the highest priority.
The greater the depth of the up folder, the lesser its priority.
The priority can be customized on the configuration with the `priorities` property, see the example below on
the [usage](#change-priorities) section.
> Note: The allowed values for `NODE_ENV` are usually `test`, `development` and `production`.
| Priority | File name |
| Priority | Filename |
| -------- | ------------------------ |

@@ -64,13 +67,35 @@ | 75 | `.env.$(NODE_ENV).local` |

Given the following folder structure with dotenv files:
```text
├── .env | PRIORITY = 1
├── apps | --------------
│ ├── .env.local | PRIORITY = 150
│ ├── nextjs | --------------
│ │ ├── .env | PRIORITY = 201
├── .env
├── .env.production
├── apps
│ ├── .env.development
│ ├── web
│ ├── docs
│ │ ├── .env
│ │ ├── .env.local
```
They can be customized on the constructor `priorities` property, see the example below on
the [usage](#change-priorities) section.
Having the following priority order:
| Path | Priority | Depth |
| ----------------------- | -------- | ----- |
| `.env` | 1 | 2 |
| `.env.production` | 25 | 2 |
| `apps/.env.development` | 25 | 1 |
| `apps/docs/.env` | 1 | 0 |
| `apps/docs/.env.local` | 50 | 0 |
Then we will have the following outcome scenarios:
| Current working directory | Env | Match |
| ------------------------- | ------------- | ----------------------- |
| `/` | `development` | `.env` |
| `/` | `production` | `.env.production` |
| `apps/web` | `development` | `.env` |
| `apps/web` | `development` | `apps/.env.development` |
| `apps/docs` | `development` | `apps/docs/.env.local` |
## 📖 Install

@@ -89,11 +114,13 @@

Add these lines at the top of the file:
Add the following line at the top of the file:
```js
// Load dotenv-mono
const {dotenvLoad} = require("dotenv-mono");
dotenvLoad();
require("dotenv-mono").load();
```
/* other */
###### Example
```js
require("dotenv-mono").load();
/**

@@ -100,0 +127,0 @@ * @type {import('next').NextConfig}

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