@dotenvx/dotenvx 1.38.5 → 1.39.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,23 @@
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.38.5...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.39.1...main)
6
+
7
+ ## [1.39.1](https://github.com/dotenvx/dotenvx/compare/v1.39.0...v1.39.1)
8
+
9
+ ### Added
10
+
11
+ * Add `version` to homebrew formula ([#564](https://github.com/dotenvx/dotenvx/pull/564))
12
+
13
+ ## [1.39.0](https://github.com/dotenvx/dotenvx/compare/v1.38.5...v1.39.0)
14
+
15
+ ### Added
16
+
17
+ * Add `--convention flow` option to `dotenvx run` ([#551](https://github.com/dotenvx/dotenvx/pull/551))
18
+
19
+ ### Changed
20
+
21
+ * Fix typos ([#550](https://github.com/dotenvx/dotenvx/pull/550))
6
22
 
7
23
  ## [1.38.5](https://github.com/dotenvx/dotenvx/compare/v1.38.4...v1.38.5)
8
24
 
@@ -306,7 +322,7 @@ FOO=${FOO}bar
306
322
 
307
323
  ### Changed
308
324
 
309
- * for `--convention nextjs` ingnore `.env.local` for TEST environment ([#425](https://github.com/dotenvx/dotenvx/pull/425))
325
+ * for `--convention nextjs` ignore `.env.local` for TEST environment ([#425](https://github.com/dotenvx/dotenvx/pull/425))
310
326
  * for `precommit` redirect missing `dotenvx` command using POSIX compliant redirection ([#424](https://github.com/dotenvx/dotenvx/pull/424))
311
327
  * make parent `dotenvx help` command less noisy by removing `[options]`. run `dotenvx COMMAND -h` to list all available options like always ([#429](https://github.com/dotenvx/dotenvx/pull/429))
312
328
 
@@ -847,7 +863,7 @@ Learn more at [https://dotenvx.com/docs/quickstart#add-encryption]
847
863
 
848
864
  ### Added
849
865
 
850
- * Support encryption replacemnt of multiline values ([#220](https://github.com/dotenvx/dotenvx/pull/220))
866
+ * Support encryption replacement of multiline values ([#220](https://github.com/dotenvx/dotenvx/pull/220))
851
867
 
852
868
  ## 0.40.0
853
869
 
@@ -900,7 +916,7 @@ Further notes:
900
916
 
901
917
  * `DOTENV_PUBLIC_KEY` lives in the `.env` file. You can safely share this with whomever you wish.
902
918
  * `DOTENV_PRIVATE_KEY` lives in your `.env.keys` file. Share this only with those you trust to decrypt your secrets.
903
- * If using encrypted `.env` files like this it is safe to commmit them to source code. This makes reviewing PRs that contain secrets much easier.
919
+ * If using encrypted `.env` files like this it is safe to commit them to source code. This makes reviewing PRs that contain secrets much easier.
904
920
  * Tell your contributors to contribute a secret using the command `dotenvx set HELLO world --encrypt`.
905
921
  * Set your `DOTENV_PRIVATE_KEY` on your server to decrypt these values using `dotenvx run -- yourcommand`
906
922
  * You can repeat all this per environment by modifying your set command to `dotenvx set HELLO production -f .env.production --encrypt` (for example)
package/README.md CHANGED
@@ -604,7 +604,7 @@ More examples
604
604
  </details>
605
605
  * <details><summary>`--convention` flag</summary><br>
606
606
 
607
- Load envs using [Next.js' convention](https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#environment-variable-load-order). Set `--convention` to `nextjs`:
607
+ Load envs using [Next.js' convention](https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#environment-variable-load-order) or [dotenv-flow convention](https://www.npmjs.com/package/dotenv-flow). Set `--convention` to `nextjs` or `flow`:
608
608
 
609
609
  ```sh
610
610
  $ echo "HELLO=development local" > .env.development.local
@@ -614,6 +614,9 @@ More examples
614
614
 
615
615
  $ dotenvx run --convention=nextjs -- node index.js
616
616
  Hello development local
617
+
618
+ $ dotenvx run --convention=flow -- node index.js
619
+ Hello development local
617
620
  ```
618
621
 
619
622
  (more conventions available upon request)
@@ -1029,6 +1032,31 @@ Advanced CLI commands.
1029
1032
 
1030
1033
  (more conventions available upon request)
1031
1034
 
1035
+ </details>
1036
+ * <details><summary>`run --convention=flow`</summary><br>
1037
+
1038
+ Load envs using [dotenv-flow's convention](https://www.npmjs.com/package/dotenv-flow). Set `--convention` to `flow`:
1039
+
1040
+ ```sh
1041
+ $ echo "HELLO=development local" > .env.development.local
1042
+ $ echo "HELLO=development" > .env.development
1043
+ $ echo "HELLO=local" > .env.local
1044
+ $ echo "HELLO=env" > .env
1045
+ $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
1046
+
1047
+ $ NODE_ENV=development dotenvx run --convention=flow -- node index.js
1048
+ [dotenvx@1.X.X] injecting env (1) from .env.development.local, .env.development, .env.local, .env
1049
+ Hello development local
1050
+ ```
1051
+
1052
+ Further, we recommend using `DOTENV_ENV` over `NODE_ENV`– as `dotenvx` works everywhere, not just node.
1053
+
1054
+ ```sh
1055
+ $ DOTENV_ENV=development dotenvx run --convention=flow -- node index.js
1056
+ [dotenvx@1.X.X] injecting env (1) from .env.development.local, .env.development, .env.local, .env
1057
+ Hello development local
1058
+ ```
1059
+
1032
1060
  </details>
1033
1061
  * <details><summary>`run -fk`</summary><br>
1034
1062
 
@@ -1131,6 +1159,29 @@ Advanced CLI commands.
1131
1159
  development local
1132
1160
  ```
1133
1161
 
1162
+ </details>
1163
+ * <details><summary>`get KEY --convention=flow`</summary><br>
1164
+
1165
+ Return a single environment variable's value using [dotenv-flow's convention](https://www.npmjs.com/package/dotenv-flow). Set `--convention` to `flow`:
1166
+
1167
+ ```sh
1168
+ $ echo "HELLO=development local" > .env.development.local
1169
+ $ echo "HELLO=development" > .env.development
1170
+ $ echo "HELLO=local" > .env.local
1171
+ $ echo "HELLO=env" > .env
1172
+ $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
1173
+
1174
+ $ NODE_ENV=development dotenvx get HELLO --convention=flow
1175
+ development local
1176
+ ```
1177
+
1178
+ Further, we recommend using `DOTENV_ENV` over `NODE_ENV`– as `dotenvx` works everywhere, not just node.
1179
+
1180
+ ```sh
1181
+ $ DOTENV_ENV=development dotenvx get HELLO --convention=flow
1182
+ development local
1183
+ ```
1184
+
1134
1185
  </details>
1135
1186
  * <details><summary>`get` (json)</summary><br>
1136
1187
 
@@ -1508,7 +1559,7 @@ Advanced CLI commands.
1508
1559
  </details>
1509
1560
  * <details><summary>`decrypt -ek`</summary><br>
1510
1561
 
1511
- Decrypt the contents inside an encrypted `.env` file except for an exluded key.
1562
+ Decrypt the contents inside an encrypted `.env` file except for an excluded key.
1512
1563
 
1513
1564
  ```sh
1514
1565
  $ echo "HELLO=World\nHOLA=Mundo" > .env
@@ -1606,7 +1657,7 @@ Advanced CLI commands.
1606
1657
  </details>
1607
1658
  * <details><summary>`keypair --format shell`</summary><br>
1608
1659
 
1609
- Print a shell formatted reponse of public/private keys.
1660
+ Print a shell formatted response of public/private keys.
1610
1661
 
1611
1662
  ```sh
1612
1663
  $ echo "HELLO=World" > .env
@@ -1757,7 +1808,7 @@ Advanced CLI commands.
1757
1808
  </details>
1758
1809
  * <details><summary>`rotate -ek`</summary><br>
1759
1810
 
1760
- Rotate the encrypted contents inside an encrypted `.env` file except for an exluded key.
1811
+ Rotate the encrypted contents inside an encrypted `.env` file except for an excluded key.
1761
1812
 
1762
1813
  ```sh
1763
1814
  $ echo "HELLO=World\nHOLA=Mundo" > .env
@@ -2212,7 +2263,7 @@ Use dotenvx directly in code.
2212
2263
  </details>
2213
2264
  * <details><summary>`set(KEY, value)`</summary><br>
2214
2265
 
2215
- Programatically set an environment variable.
2266
+ Programmatically set an environment variable.
2216
2267
 
2217
2268
  ```js
2218
2269
  // index.js
@@ -2223,7 +2274,7 @@ Use dotenvx directly in code.
2223
2274
  </details>
2224
2275
  * <details><summary>`get(KEY)` - <i>Decryption at Access</i></summary><br>
2225
2276
 
2226
- Programatically get an environment variable at access/runtime.
2277
+ Programmatically get an environment variable at access/runtime.
2227
2278
 
2228
2279
  ```js
2229
2280
  // index.js
@@ -2236,6 +2287,128 @@ Use dotenvx directly in code.
2236
2287
 
2237
2288
  </details>
2238
2289
 
2290
+ ### Pro 🏆
2291
+
2292
+ *Secrets Management – Done Right. Cloak your private keys and treat secrets like code.*
2293
+
2294
+ * <details><summary>`pro keypair`</summary><br>
2295
+
2296
+ Print fully managed public/private keys for `.env` file.
2297
+
2298
+ ```sh
2299
+ $ echo "HELLO=World" > .env
2300
+ $ dotenvx encrypt
2301
+
2302
+ $ dotenvx pro push
2303
+
2304
+ $ dotenvx pro keypair
2305
+ {"DOTENV_PUBLIC_KEY":"<publicKey>","DOTENV_PRIVATE_KEY":"<privateKey>"}
2306
+ ```
2307
+
2308
+ </details>
2309
+ * <details><summary>`pro keypair -f`</summary><br>
2310
+
2311
+ Print fully managed public/private keys for `.env.production` file.
2312
+
2313
+ ```sh
2314
+ $ echo "HELLO=Production" > .env.production
2315
+ $ dotenvx encrypt -f .env.production
2316
+
2317
+ $ dotenvx pro push
2318
+
2319
+ $ dotenvx pro keypair -f .env.production
2320
+ {"DOTENV_PUBLIC_KEY_PRODUCTION":"<publicKey>","DOTENV_PRIVATE_KEY_PRODUCTION":"<privateKey>"}
2321
+ ```
2322
+
2323
+ </details>
2324
+ * <details><summary>`pro keypair DOTENV_PRIVATE_KEY`</summary><br>
2325
+
2326
+ Print specific fully managed keypair for `.env` file.
2327
+
2328
+ ```sh
2329
+ $ echo "HELLO=World" > .env
2330
+ $ dotenvx encrypt
2331
+
2332
+ $ dotenvx pro push
2333
+
2334
+ $ dotenvx pro keypair DOTENV_PRIVATE_KEY
2335
+ <privateKey>
2336
+ ```
2337
+
2338
+ </details>
2339
+ * <details><summary>`pro settings org`</summary><br>
2340
+
2341
+ Print organization.
2342
+
2343
+ ```sh
2344
+ $ dotenvx pro settings org
2345
+ motdotla
2346
+ ```
2347
+
2348
+ </details>
2349
+ * <details><summary>`pro settings orgpublickey`</summary><br>
2350
+
2351
+ Print organization public key–used for encrypting project private keys.
2352
+
2353
+ ```sh
2354
+ $ dotenvx pro settings orgpublickey
2355
+ 02761eccd2a442ebbfa14ac2e72762d885a1e96b8949428deea62db305947d6408
2356
+ ```
2357
+
2358
+ </details>
2359
+ * <details><summary>`pro settings orgprivatekey`</summary><br>
2360
+
2361
+ Print masked organization private key–used for decrypting project private keys.
2362
+
2363
+ ```sh
2364
+ $ dotenvx pro settings orgprivatekey
2365
+ 322c004*********************************************************
2366
+ ```
2367
+
2368
+ </details>
2369
+ * <details><summary>`pro settings orgprivatekey --unmask`</summary><br>
2370
+
2371
+ Print unmasked organization private key–used for decrypting project private keys.
2372
+
2373
+ ```sh
2374
+ $ dotenvx pro settings orgprivatekey --unmask
2375
+ 322c004271ac6ad1b548df3f316ff4e8f08e17e0b15f459db64f3f3b48b0efb7
2376
+ ```
2377
+
2378
+ </details>
2379
+ * <details><summary>`pro settings orgteam`</summary><br>
2380
+
2381
+ Print team status in tabular format.
2382
+
2383
+ ```sh
2384
+ $ dotenvx pro settings orgteam
2385
+ ╔═══════════╤════════╗
2386
+ ║ username │ synced ║
2387
+ ╟───────────┼────────╢
2388
+ ║ motdotla │ ✔ ║
2389
+ ╟───────────┼────────╢
2390
+ ║ motdotenv │ ✔ ║
2391
+ ╚═══════════╧════════╝
2392
+ ```
2393
+
2394
+ </details>
2395
+ * <details><summary>`pro settings storetree`</summary><br>
2396
+
2397
+ Print encrypted store tree–backing your dotenvx pro installation.
2398
+
2399
+ ```sh
2400
+ $ dotenvx pro settings storetree
2401
+ ├─ .env
2402
+ └─ pro.dotenvx.com
2403
+ ├─ user-1-organization-1.json
2404
+ ├─ user-1-private-key.json
2405
+ └─ user-1.json
2406
+ ```
2407
+
2408
+ </details>
2409
+
2410
+ &nbsp;
2411
+
2239
2412
  ## Whitepaper
2240
2413
 
2241
2414
  > **Dotenvx: Reducing Secrets Risk with Cryptographic Separation**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.38.5",
2
+ "version": "1.39.1",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -61,7 +61,7 @@ ext.command('scan')
61
61
  .description('scan for leaked secrets')
62
62
  .action(require('./../actions/ext/scan'))
63
63
 
64
- // overide helpInformation to hide dynamic commands
64
+ // override helpInformation to hide dynamic commands
65
65
  ext.helpInformation = function () {
66
66
  const originalHelp = Command.prototype.helpInformation.call(this)
67
67
  const lines = originalHelp.split('\n')
@@ -60,7 +60,7 @@ program.command('run')
60
60
  .option('-fv, --env-vault-file <paths...>', 'path(s) to your .env.vault file(s)', collectEnvs('envVaultFile'), [])
61
61
  .option('-o, --overload', 'override existing env variables')
62
62
  .option('--strict', 'process.exit(1) on any errors', false)
63
- .option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\'])')
63
+ .option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\', \'flow\'])')
64
64
  .option('--ignore <errorCodes...>', 'error code(s) to ignore (example: --ignore=MISSING_ENV_FILE)')
65
65
  .action(function (...args) {
66
66
  this.envs = envs
@@ -79,7 +79,7 @@ program.command('get')
79
79
  .option('-fv, --env-vault-file <paths...>', 'path(s) to your .env.vault file(s)', collectEnvs('envVaultFile'), [])
80
80
  .option('-o, --overload', 'override existing env variables')
81
81
  .option('--strict', 'process.exit(1) on any errors', false)
82
- .option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\'])')
82
+ .option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\', \'flow\'])')
83
83
  .option('--ignore <errorCodes...>', 'error code(s) to ignore (example: --ignore=MISSING_ENV_FILE)')
84
84
  .option('-a, --all', 'include all machine envs as well')
85
85
  .option('-pp, --pretty-print', 'pretty print output')
@@ -219,7 +219,7 @@ program.command('precommit')
219
219
  precommitAction.apply(this, args)
220
220
  })
221
221
 
222
- // overide helpInformation to hide DEPRECATED and 'ext' commands
222
+ // override helpInformation to hide DEPRECATED and 'ext' commands
223
223
  program.helpInformation = function () {
224
224
  const originalHelp = Command.prototype.helpInformation.call(this)
225
225
  const lines = originalHelp.split('\n')
@@ -1,7 +1,8 @@
1
1
  function conventions (convention) {
2
+ const env = process.env.DOTENV_ENV || process.env.NODE_ENV || 'development'
3
+
2
4
  if (convention === 'nextjs') {
3
- const nodeEnv = process.env.NODE_ENV || 'development'
4
- const canonicalEnv = ['development', 'test', 'production'].includes(nodeEnv) && nodeEnv
5
+ const canonicalEnv = ['development', 'test', 'production'].includes(env) && env
5
6
 
6
7
  return [
7
8
  canonicalEnv && { type: 'envFile', value: `.env.${canonicalEnv}.local` },
@@ -9,8 +10,16 @@ function conventions (convention) {
9
10
  canonicalEnv && { type: 'envFile', value: `.env.${canonicalEnv}` },
10
11
  { type: 'envFile', value: '.env' }
11
12
  ].filter(Boolean)
13
+ } else if (convention === 'flow') {
14
+ return [
15
+ { type: 'envFile', value: `.env.${env}.local` },
16
+ { type: 'envFile', value: `.env.${env}` },
17
+ { type: 'envFile', value: '.env.local' },
18
+ { type: 'envFile', value: '.env' },
19
+ { type: 'envFile', value: '.env.defaults' }
20
+ ]
12
21
  } else {
13
- throw new Error(`INVALID_CONVENTION: '${convention}'. permitted conventions: ['nextjs']`)
22
+ throw new Error(`INVALID_CONVENTION: '${convention}'. permitted conventions: ['nextjs', 'flow']`)
14
23
  }
15
24
  }
16
25
 
@@ -23,12 +23,9 @@ 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 🏆`)
27
- // logger.help('? see installation instructions [https://github.com/dotenvx/dotenvx-pro]')
28
-
29
26
  const pro = `_______________________________________________________________
30
27
  | |
31
- | coming soon! (for small business) |
28
+ | For small and medium businesses |
32
29
  | |
33
30
  | | | | | |
34
31
  | __| | ___ | |_ ___ _ ____ ____ __ _ __ _ __ ___ |
@@ -37,9 +34,9 @@ function executeDynamic (program, command, rawArgs) {
37
34
  | \\__,_|\\___/ \\__\\___|_| |_|\\_/ /_/\\_\\ | .__/|_| \\___/ |
38
35
  | | | |
39
36
  | |_| |
40
- | ## learn more on github 🐙 |
37
+ | ## learn more on dotenvx 🟨 |
41
38
  | |
42
- | >> https://github.com/dotenvx/dotenvx/issues/259 |
39
+ | >> https://dotenvx.com/pricing |
43
40
  | |
44
41
  | ## subscribe on github to be notified 📣 |
45
42
  | |
@@ -50,6 +47,9 @@ function executeDynamic (program, command, rawArgs) {
50
47
  |_____________________________________________________________|`
51
48
 
52
49
  console.log(pro)
50
+ console.log('')
51
+ logger.warn(`[INSTALLATION_NEEDED] install dotenvx-${command} to use [dotenvx ${command}] commands 🏆`)
52
+ logger.help('? see installation instructions [https://github.com/dotenvx/dotenvx-pro]')
53
53
  } else {
54
54
  logger.info(`error: unknown command '${command}'`)
55
55
  }
package/src/lib/main.d.ts CHANGED
@@ -121,7 +121,7 @@ export interface DotenvConfigOptions {
121
121
  DOTENV_KEY?: string;
122
122
 
123
123
  /**
124
- * Load a .env convention (available conventions: 'nextjs')
124
+ * Load a .env convention (available conventions: 'nextjs, flow')
125
125
  */
126
126
  convention?: string;
127
127
 
@@ -191,7 +191,7 @@ export interface SetOptions {
191
191
  envKeysFile?: string;
192
192
 
193
193
  /**
194
- * Set a .env convention (available conventions: 'nextjs')
194
+ * Set a .env convention (available conventions: 'nextjs, flow')
195
195
  */
196
196
  convention?: string;
197
197
 
@@ -46,7 +46,7 @@ class Precommit {
46
46
  dotenvFiles.forEach(file => {
47
47
  count += 1
48
48
 
49
- // check if file is going to be commited
49
+ // check if file is going to be committed
50
50
  if (this._isFileToBeCommitted(file)) {
51
51
  // check if that file is being ignored
52
52
  if (ig.ignores(file)) {