@dotenvx/dotenvx 1.56.0 → 1.57.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,14 +2,35 @@
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.56.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.57.1...main)
6
+
7
+ ## [1.57.1](https://github.com/dotenvx/dotenvx/compare/v1.57.0...v1.57.1) (2026-03-21)
8
+
9
+ ### Changes
10
+
11
+ * improved error logs and compacted most to a single line ([#755](https://github.com/dotenvx/dotenvx/pull/755))
12
+ * introduced leading log glyphs as a visual status language:
13
+
14
+ * `◈` success action (encrypted)
15
+ * `◇` success action (set plain value, decrypted)
16
+ * `⟳` success action (rotated)
17
+ * `○` informational no-op (no changes)
18
+ * `▣` success action for generated/updated support files
19
+ * `⚠` warning
20
+ * `☠` error
21
+
22
+ ## [1.57.0](https://github.com/dotenvx/dotenvx/compare/v1.56.0...v1.57.0) (2026-03-19)
23
+
24
+ ### Changed
25
+
26
+ * color and formatting changes to outputs ([#754](https://github.com/dotenvx/dotenvx/pull/754))
6
27
 
7
28
  ## [1.56.0](https://github.com/dotenvx/dotenvx/compare/v1.55.1...v1.56.0) (2026-03-19)
8
29
 
9
30
  ### Changed
10
31
 
11
- - `ops off` flag — now respected by `get`, `keypair`, `rotate`, and `encrypt` ([#750](https://github.com/dotenvx/dotenvx/pull/750))
12
- - `--pp` alias — added as shorthand for `--pretty-print`; toward sunsetting `-pp` ([#750](https://github.com/dotenvx/dotenvx/pull/750))
32
+ * `ops off` flag — now respected by `get`, `keypair`, `rotate`, and `encrypt` ([#750](https://github.com/dotenvx/dotenvx/pull/750))
33
+ * `--pp` alias — added as shorthand for `--pretty-print`; toward sunsetting `-pp` ([#750](https://github.com/dotenvx/dotenvx/pull/750))
13
34
 
14
35
  ### Removed
15
36
 
@@ -1777,4 +1798,3 @@ prevent committing a `.env*` file to code. append to `.gitignore`, `.dockerignor
1777
1798
  ## 0.3.9 and prior
1778
1799
 
1779
1800
  Please see commit history.
1780
-
package/README.md CHANGED
@@ -30,7 +30,20 @@ console.log(`Hello ${process.env.HELLO}`)
30
30
 
31
31
  or install globally - *unlocks dotenv for any language, framework, or platform!*
32
32
 
33
- <details><summary>with curl 🌐 </summary><br>
33
+ <details><summary>with npm 🌍</summary><br>
34
+
35
+ ```sh
36
+ npm i -g @dotenvx/dotenvx
37
+ dotenvx help
38
+ ```
39
+
40
+ [![npm installs](https://img.shields.io/npm/dt/@dotenvx/dotenvx)](https://npmjs.com/@dotenvx/dotenvx)
41
+
42
+ &nbsp;
43
+
44
+ </details>
45
+
46
+ <details><summary>with curl 🌐</summary><br>
34
47
 
35
48
  ```sh
36
49
  curl -sfS https://dotenvx.sh | sh
@@ -632,7 +645,7 @@ Hello development local
632
645
 
633
646
  ```sh
634
647
  $ dotenvx encrypt
635
- encrypted (.env)
648
+ encrypted (.env)
636
649
  ```
637
650
 
638
651
  [![encrypted .env](https://github.com/user-attachments/assets/46dfe1a7-a027-4d80-9207-789eccc325dc)](https://dotenvx.com)
@@ -936,8 +949,7 @@ For example, when missing a custom .env file:
936
949
 
937
950
  ```sh
938
951
  $ dotenvx run -f .env.missing -- echo $HELLO
939
- [MISSING_ENV_FILE] missing .env.missing file (/Users/scottmotte/Code/dotenvx/playground/apr-16/.env.missing)
940
- [MISSING_ENV_FILE] https://github.com/dotenvx/dotenvx/issues/484 and re-run [dotenvx run -- echo]
952
+ [MISSING_ENV_FILE] missing file (/Users/scottmotte/Code/dotenvx/playground/apr-16/.env.missing). fix: [echo "HELLO=World" > .env.missing]
941
953
  ```
942
954
 
943
955
  or when missing a KEY:
@@ -945,7 +957,7 @@ or when missing a KEY:
945
957
  ```sh
946
958
  $ echo "HELLO=World" > .env
947
959
  $ dotenvx get GOODBYE
948
- [MISSING_KEY] missing GOODBYE key
960
+ [MISSING_KEY] missing key (GOODBYE)
949
961
  ```
950
962
 
951
963
  </details>
@@ -1172,8 +1184,7 @@ Exit with code `1` if any errors are encountered - like a missing .env file or d
1172
1184
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
1173
1185
 
1174
1186
  $ dotenvx run -f .env.missing --strict -- node index.js
1175
- [MISSING_ENV_FILE] missing .env.missing file (/path/to/.env.missing)
1176
- [MISSING_ENV_FILE] ? add one with [echo "HELLO=World" > .env.missing]
1187
+ [MISSING_ENV_FILE] missing file (/path/to/.env.missing). fix: [echo "HELLO=World" > .env.missing]
1177
1188
  ```
1178
1189
 
1179
1190
  This can be useful in `ci` scripts where you want to fail the ci if your `.env` file could not be decrypted at runtime.
@@ -1326,7 +1337,7 @@ Exit with code `1` if any errors are encountered - like a missing key, missing .
1326
1337
 
1327
1338
  ```sh
1328
1339
  $ dotenvx get DOES_NOT_EXIST --strict
1329
- [MISSING_KEY] missing DOES_NOT_EXIST key
1340
+ [MISSING_KEY] missing key (DOES_NOT_EXIST)
1330
1341
  ```
1331
1342
 
1332
1343
  </details>
@@ -1562,8 +1573,7 @@ Encrypt the contents of a `.env` file to an encrypted `.env` file.
1562
1573
  $ echo "HELLO=World" > .env
1563
1574
 
1564
1575
  $ dotenvx encrypt
1565
- encrypted (.env)
1566
- ✔ key added to .env.keys (DOTENV_PRIVATE_KEY)
1576
+ encrypted (.env) + key (.env.keys)
1567
1577
  ⮕ next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys
1568
1578
  ⮕ next run [DOTENV_PRIVATE_KEY='122...0b8' dotenvx run -- yourcommand] to test decryption locally
1569
1579
  ```
@@ -1578,8 +1588,7 @@ $ echo "HELLO=World" > .env
1578
1588
  $ echo "HELLO=Production" > .env.production
1579
1589
 
1580
1590
  $ dotenvx encrypt -f .env.production
1581
- encrypted (.env.production)
1582
- ✔ key added to .env.keys (DOTENV_PRIVATE_KEY_PRODUCTION)
1591
+ encrypted (.env.production) + key (.env.keys)
1583
1592
  ⮕ next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys
1584
1593
  ⮕ next run [DOTENV_PRIVATE_KEY='bff...bc4' dotenvx run -- yourcommand] to test decryption locally
1585
1594
  ```
@@ -1594,7 +1603,7 @@ $ mkdir -p apps/app1
1594
1603
  $ echo "HELLO=World" > apps/app1/.env
1595
1604
 
1596
1605
  $ dotenvx encrypt -fk .env.keys -f apps/app1/.env
1597
- encrypted (apps/app1/.env)
1606
+ encrypted (apps/app1/.env)
1598
1607
  ```
1599
1608
 
1600
1609
  Put it to use.
@@ -1619,7 +1628,7 @@ Specify the key(s) to encrypt by passing `--key`.
1619
1628
  $ echo "HELLO=World\nHELLO2=Universe" > .env
1620
1629
 
1621
1630
  $ dotenvx encrypt -k HELLO2
1622
- encrypted (.env)
1631
+ encrypted (.env)
1623
1632
  ```
1624
1633
 
1625
1634
  Even specify a glob pattern.
@@ -1628,7 +1637,7 @@ Even specify a glob pattern.
1628
1637
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1629
1638
 
1630
1639
  $ dotenvx encrypt -k "HE*"
1631
- encrypted (.env)
1640
+ encrypted (.env)
1632
1641
  ```
1633
1642
 
1634
1643
  </details>
@@ -1640,7 +1649,7 @@ Specify the key(s) to NOT encrypt by passing `--exclude-key`.
1640
1649
  $ echo "HELLO=World\nHELLO2=Universe" > .env
1641
1650
 
1642
1651
  $ dotenvx encrypt -ek HELLO
1643
- encrypted (.env)
1652
+ encrypted (.env)
1644
1653
  ```
1645
1654
 
1646
1655
  Even specify a glob pattern.
@@ -1649,7 +1658,7 @@ Even specify a glob pattern.
1649
1658
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1650
1659
 
1651
1660
  $ dotenvx encrypt -ek "HO*"
1652
- encrypted (.env)
1661
+ encrypted (.env)
1653
1662
  ```
1654
1663
 
1655
1664
  </details>
@@ -1684,9 +1693,9 @@ Decrypt the contents of an encrypted `.env` file to an unencrypted `.env` file.
1684
1693
  ```sh
1685
1694
  $ echo "HELLO=World" > .env
1686
1695
  $ dotenvx encrypt
1687
- encrypted (.env)
1696
+ encrypted (.env)
1688
1697
  $ dotenvx decrypt
1689
- decrypted (.env)
1698
+ decrypted (.env)
1690
1699
  ```
1691
1700
 
1692
1701
  </details>
@@ -1699,9 +1708,9 @@ $ echo "HELLO=World" > .env
1699
1708
  $ echo "HELLO=Production" > .env.production
1700
1709
 
1701
1710
  $ dotenvx encrypt -f .env.production
1702
- encrypted (.env.production)
1711
+ encrypted (.env.production)
1703
1712
  $ dotenvx decrypt -f .env.production
1704
- decrypted (.env.production)
1713
+ decrypted (.env.production)
1705
1714
  ```
1706
1715
 
1707
1716
  </details>
@@ -1714,9 +1723,9 @@ $ mkdir -p apps/app1
1714
1723
  $ echo "HELLO=World" > apps/app1/.env
1715
1724
 
1716
1725
  $ dotenvx encrypt -fk .env.keys -f apps/app1/.env
1717
- encrypted (apps/app1/.env)
1726
+ encrypted (apps/app1/.env)
1718
1727
  $ dotenvx decrypt -fk .env.keys -f apps/app1/.env
1719
- decrypted (apps/app1/.env)
1728
+ decrypted (apps/app1/.env)
1720
1729
  ```
1721
1730
 
1722
1731
  </details>
@@ -1727,9 +1736,9 @@ Decrypt the contents of a specified key inside an encrypted `.env` file.
1727
1736
  ```sh
1728
1737
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1729
1738
  $ dotenvx encrypt
1730
- encrypted (.env)
1739
+ encrypted (.env)
1731
1740
  $ dotenvx decrypt -k HELLO
1732
- decrypted (.env)
1741
+ decrypted (.env)
1733
1742
  ```
1734
1743
 
1735
1744
  Even specify a glob pattern.
@@ -1737,9 +1746,9 @@ Even specify a glob pattern.
1737
1746
  ```sh
1738
1747
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1739
1748
  $ dotenvx encrypt
1740
- encrypted (.env)
1749
+ encrypted (.env)
1741
1750
  $ dotenvx decrypt -k "HE*"
1742
- encrypted (.env)
1751
+ decrypted (.env)
1743
1752
  ```
1744
1753
 
1745
1754
  </details>
@@ -1750,9 +1759,9 @@ Decrypt the contents inside an encrypted `.env` file except for an excluded key.
1750
1759
  ```sh
1751
1760
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1752
1761
  $ dotenvx encrypt
1753
- encrypted (.env)
1762
+ encrypted (.env)
1754
1763
  $ dotenvx decrypt -ek HOLA
1755
- decrypted (.env)
1764
+ decrypted (.env)
1756
1765
  ```
1757
1766
 
1758
1767
  Even specify a glob pattern.
@@ -1760,9 +1769,9 @@ Even specify a glob pattern.
1760
1769
  ```sh
1761
1770
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1762
1771
  $ dotenvx encrypt
1763
- encrypted (.env)
1772
+ encrypted (.env)
1764
1773
  $ dotenvx decrypt -ek "HO*"
1765
- encrypted (.env)
1774
+ decrypted (.env)
1766
1775
  ```
1767
1776
 
1768
1777
  </details>
@@ -1933,9 +1942,9 @@ Rotate public/private keys for `.env` file and re-encrypt all encrypted values.
1933
1942
  ```sh
1934
1943
  $ echo "HELLO=World" > .env
1935
1944
  $ dotenvx encrypt
1936
- encrypted (.env)
1945
+ encrypted (.env)
1937
1946
  $ dotenvx rotate
1938
- rotated (.env)
1947
+ rotated (.env)
1939
1948
  ```
1940
1949
 
1941
1950
  </details>
@@ -1948,9 +1957,9 @@ $ echo "HELLO=World" > .env
1948
1957
  $ echo "HELLO=Production" > .env.production
1949
1958
 
1950
1959
  $ dotenvx encrypt -f .env.production
1951
- encrypted (.env.production)
1960
+ encrypted (.env.production)
1952
1961
  $ dotenvx rotate -f .env.production
1953
- rotated (.env.production)
1962
+ rotated (.env.production)
1954
1963
  ```
1955
1964
 
1956
1965
  </details>
@@ -1963,9 +1972,9 @@ $ mkdir -p apps/app1
1963
1972
  $ echo "HELLO=World" > apps/app1/.env
1964
1973
 
1965
1974
  $ dotenvx encrypt -fk .env.keys -f apps/app1/.env
1966
- encrypted (apps/app1/.env)
1975
+ encrypted (apps/app1/.env)
1967
1976
  $ dotenvx rotate -fk .env.keys -f apps/app1/.env
1968
- rotated (apps/app1/.env)
1977
+ rotated (apps/app1/.env)
1969
1978
  ```
1970
1979
 
1971
1980
  </details>
@@ -1976,9 +1985,9 @@ Rotate the contents of a specified key inside an encrypted `.env` file.
1976
1985
  ```sh
1977
1986
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1978
1987
  $ dotenvx encrypt
1979
- encrypted (.env)
1988
+ encrypted (.env)
1980
1989
  $ dotenvx rotate -k HELLO
1981
- rotated (.env)
1990
+ rotated (.env)
1982
1991
  ```
1983
1992
 
1984
1993
  Even specify a glob pattern.
@@ -1986,9 +1995,9 @@ Even specify a glob pattern.
1986
1995
  ```sh
1987
1996
  $ echo "HELLO=World\nHOLA=Mundo" > .env
1988
1997
  $ dotenvx encrypt
1989
- encrypted (.env)
1998
+ encrypted (.env)
1990
1999
  $ dotenvx rotate -k "HE*"
1991
- rotated (.env)
2000
+ rotated (.env)
1992
2001
  ```
1993
2002
 
1994
2003
  </details>
@@ -1999,9 +2008,9 @@ Rotate the encrypted contents inside an encrypted `.env` file except for an excl
1999
2008
  ```sh
2000
2009
  $ echo "HELLO=World\nHOLA=Mundo" > .env
2001
2010
  $ dotenvx encrypt
2002
- encrypted (.env)
2011
+ encrypted (.env)
2003
2012
  $ dotenvx rotate -ek HOLA
2004
- rotated (.env)
2013
+ rotated (.env)
2005
2014
  ```
2006
2015
 
2007
2016
  Even specify a glob pattern.
@@ -2009,9 +2018,9 @@ Even specify a glob pattern.
2009
2018
  ```sh
2010
2019
  $ echo "HELLO=World\nHOLA=Mundo" > .env
2011
2020
  $ dotenvx encrypt
2012
- encrypted (.env)
2021
+ encrypted (.env)
2013
2022
  $ dotenvx rotate -ek "HO*"
2014
- rotated (.env)
2023
+ rotated (.env)
2015
2024
  ```
2016
2025
 
2017
2026
  </details>
@@ -2126,7 +2135,7 @@ In one command, generate a `.env.example` file from your current `.env` file con
2126
2135
  $ echo "HELLO=World" > .env
2127
2136
 
2128
2137
  $ dotenvx ext genexample
2129
- updated .env.example (1)
2138
+ generated (.env.example)
2130
2139
  ```
2131
2140
 
2132
2141
  ```ini
@@ -2144,7 +2153,7 @@ $ echo "HELLO=World" > .env
2144
2153
  $ echo "DB_HOST=example.com" > .env.production
2145
2154
 
2146
2155
  $ dotenvx ext genexample -f .env -f .env.production
2147
- updated .env.example (2)
2156
+ generated (.env.example)
2148
2157
  ```
2149
2158
 
2150
2159
  ```ini
@@ -2164,7 +2173,7 @@ $ mkdir -p apps/backend
2164
2173
  $ echo "HELLO=Backend" > apps/backend/.env
2165
2174
 
2166
2175
  $ dotenvx ext genexample apps/backend
2167
- updated .env.example (1)
2176
+ generated (.env.example)
2168
2177
  ```
2169
2178
 
2170
2179
  ```ini
@@ -2179,7 +2188,7 @@ Gitignore your `.env` files.
2179
2188
 
2180
2189
  ```sh
2181
2190
  $ dotenvx ext gitignore
2182
- ignored .env* (.gitignore)
2191
+ ignored .env* (.gitignore)
2183
2192
  ```
2184
2193
 
2185
2194
  </details>
@@ -2189,7 +2198,7 @@ Gitignore specific pattern(s) of `.env` files.
2189
2198
 
2190
2199
  ```sh
2191
2200
  $ dotenvx ext gitignore --pattern .env.keys
2192
- ignored .env.keys (.gitignore)
2201
+ ignored .env.keys (.gitignore)
2193
2202
  ```
2194
2203
 
2195
2204
  </details>
@@ -2623,7 +2632,7 @@ Log in.
2623
2632
  $ dotenvx-ops login
2624
2633
  press Enter to open [https://ops.dotenvx.com/login/device] and enter code [D9C1-03BC]... (Y/n)
2625
2634
  ⠹ waiting on browser authorization
2626
- logged in [username] to this device and activated token [dxo_6kjPifI…]
2635
+ logged in [username] to this device and activated token [dxo_6kjPifI…]
2627
2636
  ```
2628
2637
 
2629
2638
  </details>
@@ -2633,7 +2642,7 @@ Log out.
2633
2642
 
2634
2643
  ```sh
2635
2644
  $ dotenvx ops logout
2636
- logged out [username] from this device and revoked token [dxo_5ZrwRXV…]
2645
+ logged out [username] from this device and revoked token [dxo_5ZrwRXV…]
2637
2646
  ```
2638
2647
 
2639
2648
  </details>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.56.0",
2
+ "version": "1.57.1",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a secure dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -2,7 +2,6 @@ const fsx = require('./../../lib/helpers/fsx')
2
2
  const { logger } = require('./../../shared/logger')
3
3
 
4
4
  const Decrypt = require('./../../lib/services/decrypt')
5
-
6
5
  const catchAndLog = require('../../lib/helpers/catchAndLog')
7
6
 
8
7
  function decrypt () {
@@ -23,10 +22,7 @@ function decrypt () {
23
22
  for (const processedEnv of processedEnvs) {
24
23
  if (processedEnv.error) {
25
24
  errorCount += 1
26
- logger.error(processedEnv.error.message)
27
- if (processedEnv.error.help) {
28
- logger.error(processedEnv.error.help)
29
- }
25
+ logger.error(processedEnv.error.messageWithHelp)
30
26
  } else {
31
27
  console.log(processedEnv.envSrc)
32
28
  }
@@ -50,16 +46,7 @@ function decrypt () {
50
46
 
51
47
  if (processedEnv.error) {
52
48
  errorCount += 1
53
-
54
- if (processedEnv.error.code === 'MISSING_ENV_FILE') {
55
- logger.error(processedEnv.error.message)
56
- logger.help(`? add one with [echo "HELLO=World" > ${processedEnv.envFilepath}] and re-run [dotenvx decrypt]`)
57
- } else {
58
- logger.error(processedEnv.error.message)
59
- if (processedEnv.error.help) {
60
- logger.error(processedEnv.error.help)
61
- }
62
- }
49
+ logger.error(processedEnv.error.messageWithHelp)
63
50
  } else if (processedEnv.changed) {
64
51
  fsx.writeFileX(processedEnv.filepath, processedEnv.envSrc)
65
52
 
@@ -70,9 +57,9 @@ function decrypt () {
70
57
  }
71
58
 
72
59
  if (changedFilepaths.length > 0) {
73
- logger.success(`✔ decrypted (${changedFilepaths.join(',')})`)
60
+ logger.success(`◇ decrypted (${changedFilepaths.join(',')})`)
74
61
  } else if (unchangedFilepaths.length > 0) {
75
- logger.info(`no changes (${unchangedFilepaths})`)
62
+ logger.info(`○ no changes (${unchangedFilepaths})`)
76
63
  } else {
77
64
  // do nothing - scenario when no .env files found
78
65
  }
@@ -4,7 +4,7 @@ const { logger } = require('./../../shared/logger')
4
4
  const Encrypt = require('./../../lib/services/encrypt')
5
5
 
6
6
  const catchAndLog = require('../../lib/helpers/catchAndLog')
7
- const isIgnoringDotenvKeys = require('../../lib/helpers/isIgnoringDotenvKeys')
7
+ const localDisplayPath = require('../../lib/helpers/localDisplayPath')
8
8
 
9
9
  function encrypt () {
10
10
  const options = this.opts()
@@ -34,15 +34,7 @@ function encrypt () {
34
34
  for (const processedEnv of processedEnvs) {
35
35
  logger.verbose(`encrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
36
36
  if (processedEnv.error) {
37
- if (processedEnv.error.code === 'MISSING_ENV_FILE') {
38
- logger.warn(processedEnv.error.message)
39
- logger.help(`? add one with [echo "HELLO=World" > ${processedEnv.envFilepath}] and re-run [dotenvx encrypt]`)
40
- } else {
41
- logger.warn(processedEnv.error.message)
42
- if (processedEnv.error.help) {
43
- logger.help(processedEnv.error.help)
44
- }
45
- }
37
+ logger.warn(processedEnv.error.messageWithHelp)
46
38
  } else if (processedEnv.changed) {
47
39
  fsx.writeFileX(processedEnv.filepath, processedEnv.envSrc)
48
40
 
@@ -53,23 +45,22 @@ function encrypt () {
53
45
  }
54
46
 
55
47
  if (changedFilepaths.length > 0) {
56
- logger.success(`✔ encrypted (${changedFilepaths.join(',')})`)
48
+ const keyAddedEnv = processedEnvs.find((processedEnv) => processedEnv.privateKeyAdded)
49
+ let msg = `◈ encrypted (${changedFilepaths.join(',')})`
50
+ if (keyAddedEnv) {
51
+ const envKeysFilepath = localDisplayPath(keyAddedEnv.envKeysFilepath)
52
+ msg += ` + key (${envKeysFilepath})`
53
+ }
54
+ logger.success(msg)
57
55
  } else if (unchangedFilepaths.length > 0) {
58
- logger.info(`no changes (${unchangedFilepaths})`)
56
+ logger.info(`○ no changes (${unchangedFilepaths})`)
59
57
  } else {
60
58
  // do nothing - scenario when no .env files found
61
59
  }
62
60
 
63
61
  for (const processedEnv of processedEnvs) {
64
62
  if (processedEnv.privateKeyAdded) {
65
- logger.success(`✔ key added to .env.keys (${processedEnv.privateKeyName})`)
66
- // logger.help('⮕ optional: [dotenvx ops backup] to securely backup private key')
67
-
68
- if (!isIgnoringDotenvKeys()) {
69
- logger.help('⮕ next run: [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys')
70
- }
71
-
72
- logger.help(`⮕ next run: [${processedEnv.privateKeyName}='${processedEnv.privateKey}' dotenvx run -- yourcommand] to test decryption locally`)
63
+ // intentionally quiet: success line already communicates key creation
73
64
  }
74
65
  }
75
66
  } catch (error) {
@@ -1,6 +1,8 @@
1
1
  const fsx = require('./../../../lib/helpers/fsx')
2
+ const path = require('path')
2
3
  const main = require('./../../../lib/main')
3
4
  const { logger } = require('./../../../shared/logger')
5
+ const catchAndLog = require('./../../../lib/helpers/catchAndLog')
4
6
 
5
7
  function genexample (directory) {
6
8
  logger.debug(`directory: ${directory}`)
@@ -21,18 +23,12 @@ function genexample (directory) {
21
23
  fsx.writeFileX(exampleFilepath, envExampleFile)
22
24
 
23
25
  if (addedKeys.length > 0) {
24
- logger.success(`updated .env.example (${addedKeys.length})`)
26
+ logger.success(`▣ generated (${path.basename(exampleFilepath)})`)
25
27
  } else {
26
- logger.info('no changes (.env.example)')
28
+ logger.info('no changes (.env.example)')
27
29
  }
28
30
  } catch (error) {
29
- logger.error(error.message)
30
- if (error.help) {
31
- logger.help(error.help)
32
- }
33
- if (error.code) {
34
- logger.debug(`ERROR_CODE: ${error.code}`)
35
- }
31
+ catchAndLog(error)
36
32
  process.exit(1)
37
33
  }
38
34
  }
@@ -34,9 +34,9 @@ class Generic {
34
34
  })
35
35
 
36
36
  if (changedPatterns.length > 0) {
37
- logger.success(`✔ ignored ${this.patterns} (${this.filename})`)
37
+ logger.success(`▣ ignored ${this.patterns} (${this.filename})`)
38
38
  } else {
39
- logger.info(`no changes (${this.filename})`)
39
+ logger.info(`○ no changes (${this.filename})`)
40
40
  }
41
41
  }
42
42
  }
@@ -1,6 +1,7 @@
1
1
  const { logger } = require('./../../../shared/logger')
2
2
 
3
3
  const Prebuild = require('./../../../lib/services/prebuild')
4
+ const catchAndLog = require('./../../../lib/helpers/catchAndLog')
4
5
 
5
6
  function prebuild (directory) {
6
7
  // debug args
@@ -16,19 +17,12 @@ function prebuild (directory) {
16
17
  } = new Prebuild(directory, options).run()
17
18
 
18
19
  for (const warning of warnings) {
19
- logger.warn(warning.message)
20
- if (warning.help) {
21
- logger.help(warning.help)
22
- }
20
+ logger.warn(warning.messageWithHelp)
23
21
  }
24
22
 
25
23
  logger.success(successMessage)
26
24
  } catch (error) {
27
- logger.error(error.message)
28
- if (error.help) {
29
- logger.help(error.help)
30
- }
31
-
25
+ catchAndLog(error)
32
26
  process.exit(1)
33
27
  }
34
28
  }
@@ -1,6 +1,7 @@
1
1
  const { logger } = require('./../../../shared/logger')
2
2
 
3
3
  const Precommit = require('./../../../lib/services/precommit')
4
+ const catchAndLog = require('./../../../lib/helpers/catchAndLog')
4
5
 
5
6
  function precommit (directory) {
6
7
  // debug args
@@ -16,19 +17,12 @@ function precommit (directory) {
16
17
  } = new Precommit(directory, options).run()
17
18
 
18
19
  for (const warning of warnings) {
19
- logger.warn(warning.message)
20
- if (warning.help) {
21
- logger.help(warning.help)
22
- }
20
+ logger.warn(warning.messageWithHelp)
23
21
  }
24
22
 
25
23
  logger.success(successMessage)
26
24
  } catch (error) {
27
- logger.error(error.message)
28
- if (error.help) {
29
- logger.help(error.help)
30
- }
31
-
25
+ catchAndLog(error)
32
26
  process.exit(1)
33
27
  }
34
28
  }
@@ -12,8 +12,8 @@ function scan () {
12
12
  childProcess.execSync('gitleaks version', { stdio: ['ignore', 'pipe', 'ignore'] })
13
13
  } catch (error) {
14
14
  logger.error('gitleaks: command not found')
15
- logger.help('? install gitleaks: [brew install gitleaks]')
16
- logger.help('? other install options: [https://github.com/gitleaks/gitleaks]')
15
+ logger.help('fix: install gitleaks: [brew install gitleaks]')
16
+ logger.help('fix: other install options: [https://github.com/gitleaks/gitleaks]')
17
17
  process.exit(1)
18
18
  return
19
19
  }
@@ -2,6 +2,7 @@ const { logger } = require('./../../shared/logger')
2
2
 
3
3
  const conventions = require('./../../lib/helpers/conventions')
4
4
  const escape = require('./../../lib/helpers/escape')
5
+ const catchAndLog = require('./../../lib/helpers/catchAndLog')
5
6
 
6
7
  const Get = require('./../../lib/services/get')
7
8
 
@@ -35,10 +36,7 @@ function get (key) {
35
36
  continue // ignore error
36
37
  }
37
38
 
38
- logger.error(error.message)
39
- if (error.help) {
40
- logger.error(error.help)
41
- }
39
+ logger.error(error.messageWithHelp)
42
40
  }
43
41
 
44
42
  if (key) {
@@ -75,10 +73,7 @@ function get (key) {
75
73
  }
76
74
  }
77
75
  } catch (error) {
78
- logger.error(error.message)
79
- if (error.help) {
80
- logger.error(error.help)
81
- }
76
+ catchAndLog(error)
82
77
  process.exit(1)
83
78
  }
84
79
  }