@dotenvx/dotenvx 2.3.1 → 2.3.3

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/v2.3.1...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.3.3...main)
6
+
7
+ ## [2.3.3](https://github.com/dotenvx/dotenvx/compare/v2.3.2...v2.3.3) (2026-07-09)
8
+
9
+ ### Removed
10
+
11
+ * Remove `dotenv` and `commander` for `@dotenvx/tooling` ([#878](https://github.com/dotenvx/dotenvx/pull/878))
12
+
13
+ ## [2.3.2](https://github.com/dotenvx/dotenvx/compare/v2.3.1...v2.3.2) (2026-07-09)
14
+
15
+ ### Changed
16
+
17
+ * Permit empty value for `set` ([#877](https://github.com/dotenvx/dotenvx/pull/877))
6
18
 
7
19
  ## [2.3.1](https://github.com/dotenvx/dotenvx/compare/v2.3.0...v2.3.1) (2026-07-08)
8
20
 
package/README.md CHANGED
@@ -122,7 +122,7 @@ Hello Dotenvx # with dotenvx
122
122
  > :-D
123
123
  ```
124
124
 
125
- see [extended quickstart guide](https://dotenvx.com/docs/quickstart)
125
+ see [quickstart guides](https://dotenvx.com/docs/quickstart)
126
126
 
127
127
  More examples
128
128
 
@@ -152,6 +152,59 @@ $ dotenvx run -- npx tsx index.ts
152
152
  Hello Dotenvx
153
153
  ```
154
154
 
155
+ </details>
156
+ <details><summary>Astro 🚀</summary><br>
157
+
158
+ Preface Astro scripts with `dotenvx run --` and read your env values in Astro.
159
+
160
+ ```json
161
+ {
162
+ "scripts": {
163
+ "dev": "dotenvx run -- astro dev",
164
+ "build": "dotenvx run -- astro build",
165
+ "preview": "dotenvx run -- astro preview"
166
+ }
167
+ }
168
+ ```
169
+
170
+ ```astro
171
+ export async function GET() {
172
+ return new Response(
173
+ JSON.stringify({
174
+ HELLO: process.env.HELLO,
175
+ }),
176
+ {
177
+ status: 200,
178
+ headers: {
179
+ "Content-Type": "application/json",
180
+ },
181
+ }
182
+ );
183
+ }
184
+ ```
185
+
186
+ see [astro guide](https://dotenvx.com/docs/secrets-in-astro)
187
+
188
+ </details>
189
+ <details><summary>Expo 🧭</summary><br>
190
+
191
+ Preface Expo scripts with `dotenvx run --`.
192
+
193
+ ```json
194
+ {
195
+ "scripts": {
196
+ "start": "dotenvx run -- expo start",
197
+ "reset-project": "node ./scripts/reset-project.js",
198
+ "android": "dotenvx run -- expo start --android",
199
+ "ios": "dotenvx run -- expo start --ios",
200
+ "web": "dotenvx run -- expo start --web",
201
+ "lint": "expo lint"
202
+ }
203
+ }
204
+ ```
205
+
206
+ see [expo guide](https://dotenvx.com/docs/secrets-in-expo)
207
+
155
208
  </details>
156
209
  <details><summary>Next.js ▲</summary><br>
157
210
 
@@ -222,6 +275,20 @@ export default {
222
275
  }
223
276
  ```
224
277
 
278
+ </details>
279
+ <details><summary>Bun 🥟</summary><br>
280
+
281
+ ```sh
282
+ $ echo "HELLO=Test" > .env.test
283
+ $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
284
+
285
+ $ bun index.js
286
+ Hello undefined
287
+
288
+ $ dotenvx run -f .env.test -- bun index.js
289
+ Hello Test
290
+ ```
291
+
225
292
  </details>
226
293
  <details><summary>Deno 🦕</summary><br>
227
294
 
@@ -246,20 +313,6 @@ Hello Dotenvx
246
313
  >
247
314
  > Instead, use `dotenvx` as designed, by installing the cli as a binary - via curl, brew, etc.
248
315
 
249
- </details>
250
- <details><summary>Bun 🥟</summary><br>
251
-
252
- ```sh
253
- $ echo "HELLO=Test" > .env.test
254
- $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
255
-
256
- $ bun index.js
257
- Hello undefined
258
-
259
- $ dotenvx run -f .env.test -- bun index.js
260
- Hello Test
261
- ```
262
-
263
316
  </details>
264
317
  <details><summary>Python 🐍</summary><br>
265
318
 
@@ -730,22 +783,6 @@ $ dotenvx encrypt
730
783
 
731
784
  > A `DOTENV_PUBLIC_KEY` (encryption key) and a `DOTENV_PRIVATE_KEY` (decryption key) are generated using the same public-key cryptography as [Bitcoin](https://en.bitcoin.it/wiki/Secp256k1).
732
785
 
733
- ### Protect `.env.keys` from agents
734
-
735
- After encryption, `DOTENV_PUBLIC_KEY` lives in your encrypted `.env` file. This means agents and automation can keep running `dotenvx set` and `dotenvx encrypt` without reading `.env.keys`.
736
-
737
- ```sh
738
- $ chmod a-r .env.keys
739
-
740
- $ dotenvx set HELLO World
741
- ◈ encrypted HELLO (.env)
742
-
743
- $ dotenvx encrypt
744
- ◈ encrypted (.env)
745
- ```
746
-
747
- Keep `.env.keys` unreadable by agents, while still letting them safely update encrypted values.
748
-
749
786
  More examples
750
787
 
751
788
  <details><summary>`.env`</summary><br>
@@ -843,6 +880,23 @@ $ dotenvx encrypt --stdout > .env.encrypted
843
880
  >
844
881
  > If your organization's compliance department requires [NIST approved curves](https://csrc.nist.gov/projects/elliptic-curve-cryptography) or other curves like `curve25519`, please reach out at [security@dotenvx.com](mailto:security@dotenvx.com).
845
882
 
883
+ </details>
884
+ <details><summary>agents</summary><br>
885
+
886
+ After encryption, `DOTENV_PUBLIC_KEY` lives in your encrypted `.env` file. This means agents and automation can keep running `dotenvx set` and `dotenvx encrypt` without reading `.env.keys`.
887
+
888
+ ```sh
889
+ $ chmod a-r .env.keys
890
+
891
+ $ dotenvx set HELLO World
892
+ ◈ encrypted HELLO (.env)
893
+
894
+ $ dotenvx encrypt
895
+ ◈ encrypted (.env)
896
+ ```
897
+
898
+ Keep `.env.keys` unreadable by agents, while still letting them safely update encrypted values.
899
+
846
900
  </details>
847
901
 
848
902
  &nbsp;
@@ -2942,7 +2996,8 @@ This is known as *Decryption at Access* and is written about in [the whitepaper]
2942
2996
  * [PHP](https://dotenvx.com/docs/languages/php)
2943
2997
  * [Rust](https://dotenvx.com/docs/languages/rust)
2944
2998
  * [Frameworks](https://dotenvx.com/docs#frameworks)
2945
- * [Astro](https://dotenvx.com/docs/frameworks/astro)
2999
+ * [Astro](https://dotenvx.com/docs/secrets-in-astro)
3000
+ * [Expo](https://dotenvx.com/docs/secrets-in-expo)
2946
3001
  * [Express](https://dotenvx.com/docs/frameworks/express)
2947
3002
  * [Next](https://dotenvx.com/docs/frameworks/next)
2948
3003
  * [Remix](https://dotenvx.com/docs/frameworks/remix)
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.3.1",
2
+ "version": "2.3.3",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a secure dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -44,9 +44,8 @@
44
44
  "funding": "https://dotenvx.com",
45
45
  "dependencies": {
46
46
  "@dotenvx/primitives": "^1.7.2",
47
- "commander": "^11.1.0",
47
+ "@dotenvx/tooling": "^0.2.0",
48
48
  "conf": "^10.2.0",
49
- "dotenv": "^17.4.2",
50
49
  "enquirer": "^2.4.1",
51
50
  "env-paths": "^2.2.1",
52
51
  "execa": "^5.1.1",
@@ -21,7 +21,7 @@ async function set (key, value) {
21
21
  settingSymbol = '◇'
22
22
  }
23
23
 
24
- if (typeof value === 'undefined') {
24
+ if (value === undefined || value === null) {
25
25
  if (!process.stdin.isTTY) {
26
26
  catchAndLog(new Errors({ key }).missingValue())
27
27
  process.exit(1)
@@ -47,12 +47,6 @@ async function set (key, value) {
47
47
  }
48
48
  }
49
49
 
50
- if (value === '') {
51
- catchAndLog(new Errors({ key }).missingValue())
52
- process.exit(1)
53
- return
54
- }
55
-
56
50
  const spinner = await createSpinner({ ...options, text: settingMessage })
57
51
  const sesh = new Session()
58
52
 
@@ -1,4 +1,4 @@
1
- const { Command } = require('commander')
1
+ const { Command } = require('@dotenvx/tooling')
2
2
 
3
3
  const examples = require('./../examples')
4
4
  const executeExtension = require('../../lib/helpers/executeExtension')
@@ -1,14 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /* c8 ignore start */
4
- const { Command } = require('commander')
4
+ const { Command } = require('@dotenvx/tooling')
5
5
  const program = new Command()
6
6
 
7
- const { setLogLevel, logger } = require('../shared/logger')
7
+ const { setLogLevel } = require('../shared/logger')
8
8
  const examples = require('./examples')
9
9
  const packageJson = require('./../lib/helpers/packageJson')
10
- const Errors = require('./../lib/helpers/errors')
11
- const getCommanderVersion = require('./../lib/helpers/getCommanderVersion')
12
10
  const executeDynamic = require('./../lib/helpers/executeDynamic')
13
11
  const removeDynamicHelpSection = require('./../lib/helpers/removeDynamicHelpSection')
14
12
  const removeOptionsHelpParts = require('./../lib/helpers/removeOptionsHelpParts')
@@ -23,14 +21,6 @@ function collectEnvs (type) {
23
21
  }
24
22
  }
25
23
 
26
- // surface hoisting problems
27
- const commanderVersion = getCommanderVersion()
28
- if (commanderVersion && parseInt(commanderVersion.split('.')[0], 10) >= 12) {
29
- const message = `dotenvx depends on commander@11.x.x but you are attempting to hoist commander@${commanderVersion}`
30
- const error = new Errors({ message }).dangerousDependencyHoist()
31
- logger.error(error.messageWithHelp)
32
- }
33
-
34
24
  // global log levels
35
25
  program
36
26
  .usage('run -- yourcommand')
package/src/db/session.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const fs = require('fs')
2
2
  const path = require('path')
3
3
  const Conf = require('conf')
4
- const dotenv = require('dotenv')
4
+ const { dotenv } = require('@dotenvx/tooling')
5
5
  const envPaths = require('env-paths')
6
6
 
7
7
  const jsonToEnv = require('./../lib/helpers/jsonToEnv')
@@ -4,7 +4,6 @@ const ISSUE_BY_CODE = {
4
4
  COMMAND_EXITED_WITH_CODE: 'https://github.com/dotenvx/dotenvx/issues/new',
5
5
  COMMAND_SUBSTITUTION_FAILED: 'https://github.com/dotenvx/dotenvx/issues/532',
6
6
  DECRYPTION_FAILED: 'https://github.com/dotenvx/dotenvx/issues/757',
7
- DANGEROUS_DEPENDENCY_HOIST: 'https://github.com/dotenvx/dotenvx/issues/622',
8
7
  INVALID_COLOR: 'must be 256 colors',
9
8
  INVALID_CONVENTION: 'https://github.com/dotenvx/dotenvx/issues/761',
10
9
  INVALID_PASSPHRASE: 'try again with the correct passphrase',
@@ -98,18 +97,6 @@ class Errors {
98
97
  return e
99
98
  }
100
99
 
101
- dangerousDependencyHoist () {
102
- const code = 'DANGEROUS_DEPENDENCY_HOIST'
103
- const message = `[${code}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`
104
- const help = `fix: [${ISSUE_BY_CODE[code]}]`
105
-
106
- const e = new Error(message)
107
- e.code = code
108
- e.help = help
109
- e.messageWithHelp = `${message}. ${help}`
110
- return e
111
- }
112
-
113
100
  invalidColor () {
114
101
  const code = 'INVALID_COLOR'
115
102
  const message = `[${code}] Invalid color ${this.color}`
@@ -1,10 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
-
4
- function getCommanderVersion () {
5
- const commanderMain = require.resolve('commander')
6
- const pkgPath = path.join(commanderMain, '..', 'package.json')
7
- return JSON.parse(fs.readFileSync(pkgPath, 'utf8')).version
8
- }
9
-
10
- module.exports = getCommanderVersion