@dotenvx/dotenvx 2.20.1 → 2.21.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 CHANGED
@@ -2,7 +2,18 @@
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.20.1...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.21.0...main)
6
+
7
+ ## [2.21.0](https://github.com/dotenvx/dotenvx/compare/v2.20.1...v2.21.0) (2026-08-10)
8
+
9
+ ### Added
10
+
11
+ * Add `dotenvx enc` and `dotenvx dec` shorthands for encrypt and decrypt ([#943](https://github.com/dotenvx/dotenvx/pull/943))
12
+ * Add convenient `dx` alias for shorter `dx run --`, `dx enc`, etc ([#944](https://github.com/dotenvx/dotenvx/pull/944))
13
+
14
+ ### Changed
15
+
16
+ * Patch typescript types for `path` ([#942](https://github.com/dotenvx/dotenvx/pull/942))
6
17
 
7
18
  ## [2.20.1](https://github.com/dotenvx/dotenvx/compare/v2.20.0...v2.20.1) (2026-08-07)
8
19
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.20.1",
2
+ "version": "2.21.0",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a secure dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -39,7 +39,8 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "bin": {
42
- "dotenvx": "./src/cli/dotenvx.js"
42
+ "dotenvx": "./src/cli/dotenvx.js",
43
+ "dx": "./src/cli/dotenvx.js"
43
44
  },
44
45
  "scripts": {
45
46
  "standard": "standard",
@@ -142,37 +142,45 @@ program.command('del')
142
142
  })
143
143
 
144
144
  // dotenvx encrypt
145
- program.command('encrypt')
146
- .description('encrypt .env file(s)')
147
- .option('-f, --env-file <path>', 'path(s) to your env file(s)', collectEnvs('envFile'), [])
148
- .option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
149
- .option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
150
- .option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
151
- .option('--stdout', 'send to stdout')
152
- .option('--token <token>', 'set Armor ⛨ token')
153
- .option('--no-create', 'do not create .env file(s) when missing')
154
- .option('--no-armor', 'disable Dotenvx Armor features')
155
- .option('--no-native', 'disable OS secret store features')
156
- .action(function (...args) {
157
- this.envs = envs
158
- return require('./actions/encrypt').apply(this, args)
159
- })
145
+ function configureEncryptCommand (command) {
146
+ return command
147
+ .description('encrypt .env file(s)')
148
+ .option('-f, --env-file <path>', 'path(s) to your env file(s)', collectEnvs('envFile'), [])
149
+ .option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
150
+ .option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
151
+ .option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
152
+ .option('--stdout', 'send to stdout')
153
+ .option('--token <token>', 'set Armor token')
154
+ .option('--no-create', 'do not create .env file(s) when missing')
155
+ .option('--no-armor', 'disable Dotenvx Armor features')
156
+ .option('--no-native', 'disable OS secret store features')
157
+ .action(function (...args) {
158
+ this.envs = envs
159
+ return require('./actions/encrypt').apply(this, args)
160
+ })
161
+ }
162
+ configureEncryptCommand(program.command('encrypt'))
163
+ configureEncryptCommand(program.command('enc', { hidden: true })) // shorthand
160
164
 
161
165
  // dotenvx decrypt
162
- program.command('decrypt')
163
- .description('decrypt .env file(s)')
164
- .option('-f, --env-file <path>', 'path(s) to your env file(s)', collectEnvs('envFile'), [])
165
- .option('-fk, --env-keys-file <path>', 'path(s) to your .env.keys file(s) (default: same path as your env file)', collectEnvKeys)
166
- .option('-k, --key <keys...>', 'keys(s) to decrypt (default: all keys in file)')
167
- .option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from decryption (default: none)')
168
- .option('--no-armor', 'disable Dotenvx Armor features')
169
- .option('--no-native', 'disable OS secret store features')
170
- .option('--stdout', 'send to stdout')
171
- .option('--mask [characters]', 'mask stdout values, optionally setting visible characters')
172
- .action(function (...args) {
173
- this.envs = envs
174
- return require('./actions/decrypt').apply(this, args)
175
- })
166
+ function configureDecryptCommand (command) {
167
+ return command
168
+ .description('decrypt .env file(s)')
169
+ .option('-f, --env-file <path>', 'path(s) to your env file(s)', collectEnvs('envFile'), [])
170
+ .option('-fk, --env-keys-file <path>', 'path(s) to your .env.keys file(s) (default: same path as your env file)', collectEnvKeys)
171
+ .option('-k, --key <keys...>', 'keys(s) to decrypt (default: all keys in file)')
172
+ .option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from decryption (default: none)')
173
+ .option('--no-armor', 'disable Dotenvx Armor features')
174
+ .option('--no-native', 'disable OS secret store features')
175
+ .option('--stdout', 'send to stdout')
176
+ .option('--mask [characters]', 'mask stdout values, optionally setting visible characters')
177
+ .action(function (...args) {
178
+ this.envs = envs
179
+ return require('./actions/decrypt').apply(this, args)
180
+ })
181
+ }
182
+ configureDecryptCommand(program.command('decrypt'))
183
+ configureDecryptCommand(program.command('dec', { hidden: true })) // shorthand
176
184
 
177
185
  // dotenvx keypair
178
186
  program.command('keypair')
package/src/lib/main.d.ts CHANGED
@@ -332,6 +332,16 @@ export function set(
332
332
  ): Promise<SetOutput>;
333
333
 
334
334
  export interface GetOptions {
335
+ /**
336
+ * Specify a custom path if your file containing environment variables is located elsewhere.
337
+ * Can also be an array of strings, specifying multiple paths.
338
+ *
339
+ * @default require('path').resolve(process.cwd(), '.env')
340
+ * @example require('@dotenvx/dotenvx').get('KEY', { path: '/custom/path/to/.env' })
341
+ * @example require('@dotenvx/dotenvx').get('KEY', { path: ['/path/to/first.env', '/path/to/second.env'] })
342
+ */
343
+ path?: string | string[] | URL;
344
+
335
345
  /**
336
346
  * Mask returned values, optionally setting the number of visible characters.
337
347
  * @default false