@dotenvx/dotenvx 1.50.1 → 1.51.0
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 +19 -0
- package/package.json +1 -1
- package/src/cli/actions/run.js +8 -3
- package/src/cli/dotenvx.js +1 -0
- package/src/lib/helpers/executeDynamic.js +2 -1
- package/src/lib/helpers/findPrivateKey.js +6 -2
- package/src/lib/helpers/findPublicKey.js +6 -2
- package/src/lib/main.js +8 -3
- package/src/lib/services/radar.js +2 -0
- package/src/lib/services/run.js +3 -2
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/v1.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.51.0...main)
|
|
6
|
+
|
|
7
|
+
## [1.51.0](https://github.com/dotenvx/dotenvx/compare/v1.50.1...v1.51.0) (2025-09-23)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Add `config({opsOff: true})` options and `--ops-off` flag for turning off [Dotenvx Ops](https://dotenvx.com/ops) features. ([#680](https://github.com/dotenvx/dotenvx/pull/680))
|
|
6
12
|
|
|
7
13
|
## [1.50.1](https://github.com/dotenvx/dotenvx/compare/v1.50.0...v1.50.1) (2025-09-18)
|
|
8
14
|
|
package/README.md
CHANGED
|
@@ -1247,6 +1247,15 @@ $ dotenvx set HELLO world -fk .env.keys -f apps/app1/.env
|
|
|
1247
1247
|
$ dotenvx run -fk .env.keys -f apps/app1/.env -- yourcommand
|
|
1248
1248
|
```
|
|
1249
1249
|
|
|
1250
|
+
</details>
|
|
1251
|
+
<details><summary>`run --ops-off`</summary><br>
|
|
1252
|
+
|
|
1253
|
+
Turn off [Dotenvx Ops](https://dotenvx.com/ops) features.
|
|
1254
|
+
|
|
1255
|
+
```sh
|
|
1256
|
+
$ dotenvx run --ops-off -- yourcommand
|
|
1257
|
+
```
|
|
1258
|
+
|
|
1250
1259
|
</details>
|
|
1251
1260
|
<details><summary>`get KEY`</summary><br>
|
|
1252
1261
|
|
|
@@ -2453,6 +2462,16 @@ HELLO="World"
|
|
|
2453
2462
|
require('@dotenvx/dotenvx').config({path: ['.env'], envKeysFile: '../../.env.keys'})
|
|
2454
2463
|
```
|
|
2455
2464
|
|
|
2465
|
+
</details>
|
|
2466
|
+
<details><summary>`config(opsOff:)` - opsOff</summary><br>
|
|
2467
|
+
|
|
2468
|
+
Turn off [Dotenvx Ops](https://dotenvx.com/ops) features.
|
|
2469
|
+
|
|
2470
|
+
```js
|
|
2471
|
+
// index.js
|
|
2472
|
+
require('@dotenvx/dotenvx').config({opsOff: true})
|
|
2473
|
+
```
|
|
2474
|
+
|
|
2456
2475
|
</details>
|
|
2457
2476
|
<details><summary>`parse(src)`</summary><br>
|
|
2458
2477
|
|
package/package.json
CHANGED
package/src/cli/actions/run.js
CHANGED
|
@@ -18,6 +18,9 @@ async function run () {
|
|
|
18
18
|
|
|
19
19
|
const ignore = options.ignore || []
|
|
20
20
|
|
|
21
|
+
// dotenvx-ops related
|
|
22
|
+
const opsOn = options.opsOff !== true
|
|
23
|
+
|
|
21
24
|
if (commandArgs.length < 1) {
|
|
22
25
|
const hasSeparator = process.argv.indexOf('--') !== -1
|
|
23
26
|
|
|
@@ -49,10 +52,12 @@ async function run () {
|
|
|
49
52
|
readableStrings,
|
|
50
53
|
readableFilepaths,
|
|
51
54
|
uniqueInjectedKeys
|
|
52
|
-
} = new Run(envs, options.overload, process.env.DOTENV_KEY, process.env, options.envKeysFile).run()
|
|
55
|
+
} = new Run(envs, options.overload, process.env.DOTENV_KEY, process.env, options.envKeysFile, opsOn).run()
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
if (opsOn) {
|
|
58
|
+
try { new Radar().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
|
|
59
|
+
try { new Ops().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
|
|
60
|
+
}
|
|
56
61
|
|
|
57
62
|
for (const processedEnv of processedEnvs) {
|
|
58
63
|
if (processedEnv.type === 'envVaultFile') {
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -73,6 +73,7 @@ program.command('run')
|
|
|
73
73
|
.option('--strict', 'process.exit(1) on any errors', false)
|
|
74
74
|
.option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\', \'flow\'])')
|
|
75
75
|
.option('--ignore <errorCodes...>', 'error code(s) to ignore (example: --ignore=MISSING_ENV_FILE)')
|
|
76
|
+
.option('--ops-off', 'disable dotenvx-ops features', false)
|
|
76
77
|
.action(function (...args) {
|
|
77
78
|
this.envs = envs
|
|
78
79
|
runAction.apply(this, args)
|
|
@@ -23,7 +23,8 @@ function executeDynamic (program, command, rawArgs) {
|
|
|
23
23
|
const result = childProcess.spawnSync(`dotenvx-${command}`, forwardedArgs, { stdio: 'inherit', env })
|
|
24
24
|
if (result.error) {
|
|
25
25
|
if (command === 'pro') {
|
|
26
|
-
logger.warn(`[INSTALLATION_NEEDED] install dotenvx-${command} to use [dotenvx
|
|
26
|
+
logger.warn(`[INSTALLATION_NEEDED] install dotenvx-${command} to use [dotenvx-${command}] commands 🏆`)
|
|
27
|
+
logger.warn('[DEPRECATION NOTICE] dotenvx-pro to be sunsetted soon (2026) and its featureset to be rolled into dotenvx-ops')
|
|
27
28
|
logger.help('? see installation instructions [https://github.com/dotenvx/dotenvx-pro]')
|
|
28
29
|
} else if (command === 'ops') {
|
|
29
30
|
const ops = ` _______________________________________________________________________
|
|
@@ -5,11 +5,15 @@ const ProKeypair = require('./proKeypair')
|
|
|
5
5
|
// services
|
|
6
6
|
const Keypair = require('./../services/keypair')
|
|
7
7
|
|
|
8
|
-
function findPrivateKey (envFilepath, envKeysFilepath = null) {
|
|
8
|
+
function findPrivateKey (envFilepath, envKeysFilepath = null, opsOn = true) {
|
|
9
9
|
// use path/to/.env.${environment} to generate privateKeyName
|
|
10
10
|
const privateKeyName = guessPrivateKeyName(envFilepath)
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
let proKeypairs = {}
|
|
13
|
+
if (opsOn) {
|
|
14
|
+
proKeypairs = new ProKeypair(envFilepath).run() // TODO: implement custom envKeysFilepath
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
const keypairs = new Keypair(envFilepath, envKeysFilepath).run()
|
|
14
18
|
|
|
15
19
|
return proKeypairs[privateKeyName] || keypairs[privateKeyName]
|
|
@@ -5,10 +5,14 @@ const ProKeypair = require('./proKeypair')
|
|
|
5
5
|
// services
|
|
6
6
|
const Keypair = require('./../services/keypair')
|
|
7
7
|
|
|
8
|
-
function findPublicKey (envFilepath) {
|
|
8
|
+
function findPublicKey (envFilepath, opsOn = true) {
|
|
9
9
|
const publicKeyName = guessPublicKeyName(envFilepath)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let proKeypairs = {}
|
|
12
|
+
if (opsOn) {
|
|
13
|
+
proKeypairs = new ProKeypair(envFilepath).run()
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
const keypairs = new Keypair(envFilepath).run()
|
|
13
17
|
|
|
14
18
|
return proKeypairs[publicKeyName] || keypairs[publicKeyName]
|
package/src/lib/main.js
CHANGED
|
@@ -47,6 +47,9 @@ const config = function (options = {}) {
|
|
|
47
47
|
DOTENV_KEY = options.DOTENV_KEY
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// dotenvx-ops related
|
|
51
|
+
const opsOn = options.opsOff !== true
|
|
52
|
+
|
|
50
53
|
if (options) {
|
|
51
54
|
setLogLevel(options)
|
|
52
55
|
setLogName(options)
|
|
@@ -61,10 +64,12 @@ const config = function (options = {}) {
|
|
|
61
64
|
processedEnvs,
|
|
62
65
|
readableFilepaths,
|
|
63
66
|
uniqueInjectedKeys
|
|
64
|
-
} = new Run(envs, overload, DOTENV_KEY, processEnv, envKeysFile).run()
|
|
67
|
+
} = new Run(envs, overload, DOTENV_KEY, processEnv, envKeysFile, opsOn).run()
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
if (opsOn) {
|
|
70
|
+
try { new Radar().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
|
|
71
|
+
try { new Ops().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
|
|
72
|
+
}
|
|
68
73
|
|
|
69
74
|
let lastError
|
|
70
75
|
/** @type {Record<string, string>} */
|
|
@@ -10,11 +10,13 @@ class Radar {
|
|
|
10
10
|
// check npm lib
|
|
11
11
|
try {
|
|
12
12
|
this.radarLib = this._radarNpm()
|
|
13
|
+
logger.warn('[DEPRECATION NOTICE] dotenvx-radar is renamed dotenv-ops. [See https://dotenvx.com/docs/ops]')
|
|
13
14
|
logger.successv(`📡 radar: ${this.radarLib.status}`)
|
|
14
15
|
} catch (e) {
|
|
15
16
|
// check binary cli
|
|
16
17
|
try {
|
|
17
18
|
this.radarLib = this._radarCli()
|
|
19
|
+
logger.warn('[DEPRECATION NOTICE] dotenvx-radar is renamed dotenv-ops. [See https://dotenvx.com/docs/ops]')
|
|
18
20
|
logger.successv(`📡 radar: ${this.radarLib.status}`)
|
|
19
21
|
} catch (_e2) {
|
|
20
22
|
// noop
|
package/src/lib/services/run.js
CHANGED
|
@@ -16,12 +16,13 @@ const guessPrivateKeyName = require('./../helpers/guessPrivateKeyName')
|
|
|
16
16
|
const determineEnvs = require('./../helpers/determineEnvs')
|
|
17
17
|
|
|
18
18
|
class Run {
|
|
19
|
-
constructor (envs = [], overload = false, DOTENV_KEY = '', processEnv = process.env, envKeysFilepath = null) {
|
|
19
|
+
constructor (envs = [], overload = false, DOTENV_KEY = '', processEnv = process.env, envKeysFilepath = null, opsOn = true) {
|
|
20
20
|
this.envs = determineEnvs(envs, processEnv, DOTENV_KEY)
|
|
21
21
|
this.overload = overload
|
|
22
22
|
this.DOTENV_KEY = DOTENV_KEY
|
|
23
23
|
this.processEnv = processEnv
|
|
24
24
|
this.envKeysFilepath = envKeysFilepath
|
|
25
|
+
this.opsOn = opsOn
|
|
25
26
|
|
|
26
27
|
this.processedEnvs = []
|
|
27
28
|
this.readableFilepaths = new Set()
|
|
@@ -96,7 +97,7 @@ class Run {
|
|
|
96
97
|
const src = fsx.readFileX(filepath, { encoding })
|
|
97
98
|
this.readableFilepaths.add(envFilepath)
|
|
98
99
|
|
|
99
|
-
const privateKey = findPrivateKey(envFilepath, this.envKeysFilepath)
|
|
100
|
+
const privateKey = findPrivateKey(envFilepath, this.envKeysFilepath, this.opsOn)
|
|
100
101
|
const privateKeyName = guessPrivateKeyName(envFilepath)
|
|
101
102
|
const { parsed, errors, injected, preExisted } = new Parse(src, privateKey, this.processEnv, this.overload, privateKeyName).run()
|
|
102
103
|
|