@dotenvx/dotenvx 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/README.md +22 -0
- package/package.json +1 -1
- package/src/lib/helpers/buildConfigEnvs.js +13 -0
- package/src/lib/main.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.4.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.4.1...main)
|
|
6
|
+
|
|
7
|
+
## [2.4.1](https://github.com/dotenvx/dotenvx/compare/v2.4.0...v2.4.1) (2026-07-10)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Support `config(path:)` as a directory like `app/web`. Useful for monorepos ([#882](https://github.com/dotenvx/dotenvx/pull/882))
|
|
6
12
|
|
|
7
13
|
## [2.4.0](https://github.com/dotenvx/dotenvx/compare/v2.3.4...v2.4.0) (2026-07-10)
|
|
8
14
|
|
package/README.md
CHANGED
|
@@ -2928,6 +2928,28 @@ You can also set `DOTENV_CONFIG_CONVENTION=nextjs`.
|
|
|
2928
2928
|
$ DOTENV_CONFIG_CONVENTION=nextjs node index.js
|
|
2929
2929
|
```
|
|
2930
2930
|
|
|
2931
|
+
</details>
|
|
2932
|
+
<details><summary>`config(path: directory, convention: 'nextjs')` - directory</summary><br>
|
|
2933
|
+
|
|
2934
|
+
Use a directory as `path` to make it the base for convention files. This is useful when loading a workspace's env files from a monorepo root.
|
|
2935
|
+
|
|
2936
|
+
```js
|
|
2937
|
+
// index.js
|
|
2938
|
+
require('@dotenvx/dotenvx').config({
|
|
2939
|
+
path: 'apps/web',
|
|
2940
|
+
convention: 'nextjs'
|
|
2941
|
+
})
|
|
2942
|
+
```
|
|
2943
|
+
|
|
2944
|
+
This loads the convention from `apps/web`:
|
|
2945
|
+
|
|
2946
|
+
```text
|
|
2947
|
+
apps/web/.env.development.local
|
|
2948
|
+
apps/web/.env.local
|
|
2949
|
+
apps/web/.env.development
|
|
2950
|
+
apps/web/.env
|
|
2951
|
+
```
|
|
2952
|
+
|
|
2931
2953
|
</details>
|
|
2932
2954
|
<details><summary>`config(noArmor:)` - noArmor</summary><br>
|
|
2933
2955
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const buildCommandEnvs = require('./buildCommandEnvs')
|
|
2
|
+
const buildEnvs = require('./buildEnvs')
|
|
3
|
+
|
|
4
|
+
function buildConfigEnvs (options = {}) {
|
|
5
|
+
if (options.envs) {
|
|
6
|
+
return options.envs
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const pathOptions = { ...options, convention: undefined }
|
|
10
|
+
return buildCommandEnvs(buildEnvs(pathOptions), options.convention)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = buildConfigEnvs
|
package/src/lib/main.js
CHANGED
|
@@ -18,6 +18,7 @@ const setTransform = require('./transforms/set')
|
|
|
18
18
|
|
|
19
19
|
// helpers
|
|
20
20
|
const buildEnvs = require('./helpers/buildEnvs')
|
|
21
|
+
const buildConfigEnvs = require('./helpers/buildConfigEnvs')
|
|
21
22
|
const { determine } = require('./helpers/envResolution')
|
|
22
23
|
const fsx = require('./helpers/fsx')
|
|
23
24
|
const decryptKeyValue = require('./helpers/cryptography/decryptKeyValue')
|
|
@@ -69,7 +70,7 @@ const config = function (options = {}) {
|
|
|
69
70
|
const noKeychain = resolveNoKeychain(options)
|
|
70
71
|
|
|
71
72
|
try {
|
|
72
|
-
let envs =
|
|
73
|
+
let envs = buildConfigEnvs(options)
|
|
73
74
|
if (!options.envs) {
|
|
74
75
|
envs = determine(envs, processEnv)
|
|
75
76
|
}
|