@dotenvx/dotenvx 1.50.1 → 1.51.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 CHANGED
@@ -2,7 +2,19 @@
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.50.1...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.51.1...main)
6
+
7
+ ## [1.51.1](https://github.com/dotenvx/dotenvx/compare/v1.51.0...v1.51.1) (2025-11-03)
8
+
9
+ ### Added
10
+
11
+ * Add `opsOff` type information
12
+
13
+ ## [1.51.0](https://github.com/dotenvx/dotenvx/compare/v1.50.1...v1.51.0) (2025-09-23)
14
+
15
+ ### Added
16
+
17
+ * 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
18
 
7
19
  ## [1.50.1](https://github.com/dotenvx/dotenvx/compare/v1.50.0...v1.50.1) (2025-09-18)
8
20
 
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,48 @@ HELLO="World"
2453
2462
  require('@dotenvx/dotenvx').config({path: ['.env'], envKeysFile: '../../.env.keys'})
2454
2463
  ```
2455
2464
 
2465
+ </details>
2466
+ <details><summary>`config(convention:)` - convention</summary><br>
2467
+
2468
+ Set a convention when using `dotenvx.config()`. This allows you to use the same file loading order as the CLI without needing to specify each file individually.
2469
+
2470
+ ```sh
2471
+ # Setup environment files
2472
+ $ echo "HELLO=development local" > .env.development.local
2473
+ $ echo "HELLO=local" > .env.local
2474
+ $ echo "HELLO=development" > .env.development
2475
+ $ echo "HELLO=env" > .env
2476
+ ```
2477
+
2478
+ ```js
2479
+ // index.js
2480
+ require('@dotenvx/dotenvx').config({ convention: 'nextjs' })
2481
+
2482
+ console.log(`Hello ${process.env.HELLO}`)
2483
+ ```
2484
+
2485
+ ```sh
2486
+ $ NODE_ENV=development node index.js
2487
+ [dotenvx@1.28.0] injecting env (1) from .env.development.local, .env.local, .env.development, .env
2488
+ Hello development local
2489
+ ```
2490
+
2491
+ This is equivalent to using `--convention=nextjs` with the CLI:
2492
+
2493
+ ```sh
2494
+ $ dotenvx run --convention=nextjs -- node index.js
2495
+ ```
2496
+
2497
+ </details>
2498
+ <details><summary>`config(opsOff:)` - opsOff</summary><br>
2499
+
2500
+ Turn off [Dotenvx Ops](https://dotenvx.com/ops) features.
2501
+
2502
+ ```js
2503
+ // index.js
2504
+ require('@dotenvx/dotenvx').config({opsOff: true})
2505
+ ```
2506
+
2456
2507
  </details>
2457
2508
  <details><summary>`parse(src)`</summary><br>
2458
2509
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.50.1",
2
+ "version": "1.51.1",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a secure dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -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
- try { new Radar().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
55
- try { new Ops().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
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') {
@@ -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 ${command}] commands 🏆`)
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
- const proKeypairs = new ProKeypair(envFilepath).run() // TODO: implement custom envKeysFilepath
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
- const proKeypairs = new ProKeypair(envFilepath).run()
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.d.ts CHANGED
@@ -146,6 +146,14 @@ export interface DotenvConfigOptions {
146
146
  | 'help'
147
147
  | 'verbose'
148
148
  | 'debug';
149
+
150
+ /**
151
+ * Turn off Dotenvx Ops features - https://dotenvx.com/ops
152
+ *
153
+ * @default false
154
+ * @example require('@dotenvx/dotenvx').config({ opsOff: true })
155
+ */
156
+ opsOff?: boolean;
149
157
  }
150
158
 
151
159
  export interface DotenvConfigOutput {
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
- try { new Radar().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
67
- try { new Ops().observe({ beforeEnv, processedEnvs, afterEnv }) } catch {}
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
@@ -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