dotenv-diff 2.3.11 → 2.4.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +151 -5
  2. package/README.md +112 -205
  3. package/dist/src/cli/run.js +6 -2
  4. package/dist/src/cli/run.js.map +1 -1
  5. package/dist/src/commands/compare.d.ts +1 -1
  6. package/dist/src/commands/compare.d.ts.map +1 -1
  7. package/dist/src/commands/compare.js +1 -1
  8. package/dist/src/commands/compare.js.map +1 -1
  9. package/dist/src/commands/scanUsage.js +15 -2
  10. package/dist/src/commands/scanUsage.js.map +1 -1
  11. package/dist/src/config/types.d.ts +3 -1
  12. package/dist/src/config/types.d.ts.map +1 -1
  13. package/dist/src/core/detectClientExposure.d.ts +12 -0
  14. package/dist/src/core/detectClientExposure.d.ts.map +1 -0
  15. package/dist/src/core/detectClientExposure.js +62 -0
  16. package/dist/src/core/detectClientExposure.js.map +1 -0
  17. package/dist/src/core/determineComparisonFile.d.ts +7 -5
  18. package/dist/src/core/determineComparisonFile.d.ts.map +1 -1
  19. package/dist/src/core/determineComparisonFile.js +8 -3
  20. package/dist/src/core/determineComparisonFile.js.map +1 -1
  21. package/dist/src/core/envPairing.d.ts +9 -0
  22. package/dist/src/core/envPairing.d.ts.map +1 -0
  23. package/dist/src/core/envPairing.js +33 -0
  24. package/dist/src/core/envPairing.js.map +1 -0
  25. package/dist/src/core/frameworks/nextJsRules.d.ts.map +1 -1
  26. package/dist/src/core/frameworks/nextJsRules.js +50 -24
  27. package/dist/src/core/frameworks/nextJsRules.js.map +1 -1
  28. package/dist/src/core/helpers/resolveFromCwd.d.ts +11 -4
  29. package/dist/src/core/helpers/resolveFromCwd.d.ts.map +1 -1
  30. package/dist/src/core/helpers/resolveFromCwd.js +11 -4
  31. package/dist/src/core/helpers/resolveFromCwd.js.map +1 -1
  32. package/dist/src/core/scanJsonOutput.d.ts.map +1 -1
  33. package/dist/src/core/scanJsonOutput.js +1 -11
  34. package/dist/src/core/scanJsonOutput.js.map +1 -1
  35. package/dist/src/core/secretDetectors.d.ts.map +1 -1
  36. package/dist/src/core/secretDetectors.js +5 -0
  37. package/dist/src/core/secretDetectors.js.map +1 -1
  38. package/dist/src/core/t3env/t3EnvRules.d.ts.map +1 -1
  39. package/dist/src/core/t3env/t3EnvRules.js +28 -32
  40. package/dist/src/core/t3env/t3EnvRules.js.map +1 -1
  41. package/dist/src/index.js +0 -5
  42. package/dist/src/index.js.map +1 -1
  43. package/dist/src/services/codeBaseScanner.d.ts.map +1 -1
  44. package/dist/src/services/codeBaseScanner.js +1 -0
  45. package/dist/src/services/codeBaseScanner.js.map +1 -1
  46. package/dist/src/services/duplicates.d.ts +2 -4
  47. package/dist/src/services/duplicates.d.ts.map +1 -1
  48. package/dist/src/services/duplicates.js.map +1 -1
  49. package/dist/src/services/fileWalker.d.ts +7 -5
  50. package/dist/src/services/fileWalker.d.ts.map +1 -1
  51. package/dist/src/services/fileWalker.js +2 -2
  52. package/dist/src/services/fileWalker.js.map +1 -1
  53. package/dist/src/services/scanOutputToConsole.d.ts +8 -6
  54. package/dist/src/services/scanOutputToConsole.d.ts.map +1 -1
  55. package/dist/src/services/scanOutputToConsole.js +3 -11
  56. package/dist/src/services/scanOutputToConsole.js.map +1 -1
  57. package/dist/src/ui/compare/printStats.d.ts +2 -1
  58. package/dist/src/ui/compare/printStats.d.ts.map +1 -1
  59. package/dist/src/ui/compare/printStats.js +5 -2
  60. package/dist/src/ui/compare/printStats.js.map +1 -1
  61. package/dist/src/ui/scan/printExposedVars.d.ts +8 -0
  62. package/dist/src/ui/scan/printExposedVars.d.ts.map +1 -0
  63. package/dist/src/ui/scan/printExposedVars.js +24 -0
  64. package/dist/src/ui/scan/printExposedVars.js.map +1 -0
  65. package/dist/src/ui/scan/printHeader.d.ts.map +1 -1
  66. package/dist/src/ui/scan/printHeader.js +0 -3
  67. package/dist/src/ui/scan/printHeader.js.map +1 -1
  68. package/dist/src/ui/scan/printMissingExample.d.ts.map +1 -1
  69. package/dist/src/ui/scan/printMissingExample.js +12 -9
  70. package/dist/src/ui/scan/printMissingExample.js.map +1 -1
  71. package/dist/src/ui/scan/printStats.d.ts +1 -0
  72. package/dist/src/ui/scan/printStats.d.ts.map +1 -1
  73. package/dist/src/ui/scan/printStats.js +2 -0
  74. package/dist/src/ui/scan/printStats.js.map +1 -1
  75. package/dist/src/ui/shared/printAutoFix.js +1 -1
  76. package/dist/src/ui/shared/printAutoFix.js.map +1 -1
  77. package/dist/src/ui/shared/printConfigStatus.d.ts +2 -2
  78. package/dist/src/ui/shared/printConfigStatus.d.ts.map +1 -1
  79. package/dist/src/ui/shared/printConfigStatus.js +5 -3
  80. package/dist/src/ui/shared/printConfigStatus.js.map +1 -1
  81. package/package.json +18 -12
package/CHANGELOG.md CHANGED
@@ -1,108 +1,181 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
  This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
4
5
 
5
6
  ## [Unreleased]
7
+
8
+ ### Added
9
+
10
+ -
11
+
12
+ ### Changed
13
+
14
+ -
15
+
16
+ ### Fixed
17
+
18
+ -
19
+
20
+ ## [2.4.0] - 2025-12-26
21
+
22
+ ### Changed
23
+
24
+ - Added spacing before missing example file message in scan usage output.
25
+ - Changed path display for print missing example file message to show only filename instead of full path.
26
+
27
+ ### Fixed
28
+
29
+ - Fixed compare mode value mismatch count not showing in stats output if --check-values flag isn't used.
30
+ - Fixed t3-env integration not working as expected in some edge cases.
31
+ - Fixed nextjs framework validator not working as expected in some edge cases.
32
+
33
+ ## [2.3.12] - 2025-12-18
34
+
6
35
  ### Added
7
- -
36
+
37
+ - Added warnings count to scan usage stats.
8
38
 
9
39
  ### Changed
10
- -
40
+
41
+ - Updated dependencies to latest versions.
42
+ - Moved `healthScore` further down on the console output for better visibility of issues.
43
+ - Removed used variables output from scan usage to reduce noise.
44
+ - Removed header output from scan usage to reduce noise.
45
+ - Shortened config file path in CLI output to show only the filename.
46
+ - Updated README documentation for better clarity.
11
47
 
12
48
  ### Fixed
13
- -
49
+
50
+ - Fixed false positive secret detection for certain harmless attribute keys in codebase scanner.
51
+ - Fixed print fix bug
14
52
 
15
53
  ## [2.3.11] - 2025-12-13
54
+
16
55
  ### Changed
56
+
17
57
  - Removed low severity secrets from codebase scanner results, because it made too much noise.
18
58
 
19
59
  ## [2.3.10] - 2025-12-11
60
+
20
61
  ### Added
62
+
21
63
  - More jsDocs for better code documentation.
22
64
  - t3-env integration to validate environment variable usage against T3 stack schema.
23
65
 
24
66
  ### Fixed
67
+
25
68
  - Removed unused code for old --no-compare option.
26
69
 
27
70
  ## [2.3.9] - 2025-12-09
71
+
28
72
  ### Added
73
+
29
74
  - Added expiration date warnings for environment variables in codebase scanner.
30
75
  - Added inconsistent naming warnings for environment variables in codebase scanner.
31
76
 
32
77
  ### Changed
78
+
33
79
  - Changed health score calculation weights for better accuracy.
34
80
  - Removed CSP detection from codebase scanner, as it was causing false positives in some cases for backend frameworks.
35
81
 
36
82
  ## [2.3.8] - 2025-12-08
83
+
37
84
  ### Added
85
+
38
86
  - Added variables not using uppercase letters warning to codebase scanner.
39
87
  - Added health score feature to codebase scanner.
40
88
 
41
89
  ### Changed
90
+
42
91
  - Removed --no-compare option from CLI and config file.
43
92
  - Updated dependencies to latest versions.
44
93
 
45
94
  ### Fixed
95
+
46
96
  - Fixed issue where show-stats and show-unused options were not working as expected in config file.
47
97
 
48
98
  ## [2.3.7] - 2025-12-03
99
+
49
100
  ### Added
101
+
50
102
  - Added warning for environment variables logged to console in codebase scanner.
51
103
 
52
104
  ### Changed
105
+
53
106
  - Updated dependencies to latest versions.
54
107
 
55
108
  ### Fixed
109
+
56
110
  - Updated jsDocs for better code documentation.
57
111
  - Updated some functions for better type safety.
58
112
 
59
113
  ## [2.3.6] - 2025-12-02
114
+
60
115
  ### Added
116
+
61
117
  - Added strict mode handling for framework specific warnings.
62
118
  - Added Next.js specific warnings to framework validator.
63
119
 
64
120
  ### Fixed
121
+
65
122
  - Nameing convention fix in frameworkValidator.ts
66
123
 
67
124
  ## [2.3.5] - 2025-12-01
125
+
68
126
  ### Added
127
+
69
128
  - Added more sveltekit specific warnings to codebase scanner.
70
129
  - Added warning for potential secrets in .env.example file.
71
130
 
72
131
  ### Fixed
132
+
73
133
  - Duration refactored for better code maintainability.
74
134
 
75
135
  ## [2.3.4] - 2025-11-05
136
+
76
137
  ### Fixed
138
+
77
139
  - Fixed issue where CSP detection was not working as expected in some file types.
78
140
 
79
141
  ## [2.3.3] - 2025-11-30
142
+
80
143
  ### Added
144
+
81
145
  - Added Content-Security-Policy (CSP) detection to codebase scanner.
82
146
  - Warns if no CSP is found in HTML/JS/TS files.
83
147
 
84
148
  ### Changed
149
+
85
150
  - No breaking changes.
86
151
 
87
152
  ## [2.3.2] - 2025-11-01
153
+
88
154
  ### Added
155
+
89
156
  - Added duration output to scan statistics.
90
157
  - Severity levels for secret findings: high, medium, low.
91
158
 
92
159
  ### Changed
160
+
93
161
  - Updated dependencies to latest versions.
94
162
  - Improved README documentation for clarity.
95
163
  - No breaking changes.
96
164
 
97
165
  ## [2.3.1] - 2025-10-08
166
+
98
167
  ### Fixed
168
+
99
169
  - Fixed dotenv-diff.config.json not found in monorepo root when running from apps.
100
170
 
101
171
  ## [2.3.0] - 2025-10-07
172
+
102
173
  ### Fixed
174
+
103
175
  - Fixed issue where .env.example would be ignored by git when using --fix flag.
104
176
 
105
177
  ### Added
178
+
106
179
  - HTML comments to ignore secret detection in HTML lines (e.g. `<!-- dotenv-diff-ignore -->`).
107
180
  - Also ignore html sections with `<!-- dotenv-diff-ignore-start -->` and `<!-- dotenv-diff-ignore-end -->`.
108
181
  - Added option to have a dotenv-diff.config.json file for configuration.
@@ -111,203 +184,276 @@ This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semant
111
184
  - --no-compare flag to disable comparison mode in scan usage. and noCompare option in config file.
112
185
 
113
186
  ## [2.2.8] - 2025-09-30
187
+
114
188
  ### Added
189
+
115
190
  - Fix .env is not ignored by git when using --fix flag.
116
191
 
117
192
  ### Changed
193
+
118
194
  - No breaking changes.
119
195
 
120
196
  ### Fixed
197
+
121
198
  - Refactored codebase for better maintainability.
122
199
 
123
200
  ## [2.2.7] - 2025-09-28
201
+
124
202
  ### Added
203
+
125
204
  - Added warning on .env not ignored by .gitignore on default.
126
205
  - added `dotenv-diff-ignore` comment to ignore lines from secret detection.
127
206
 
128
207
  ### Fixed
208
+
129
209
  - Fixed `--strict` error output to console when no warnings are found.
130
210
 
131
211
  ### Changed
212
+
132
213
  - No breaking changes.
133
214
  - Updated dependencies to latest versions.
134
215
 
135
216
  ## [2.2.6] - 2025-09-25
217
+
136
218
  ### Added
219
+
137
220
  - Added `placeholder`, `127.0.0.1`, and `example` to `looksHarmless` secret detection rule.
138
221
  - Added `HTTP URL detected` message to potential secrets output.
139
222
 
140
223
  ### Fixed
224
+
141
225
  - Removed `All used environment variables are defined in {.env}` when there are no used variables found.
142
226
 
143
227
  ### Changed
228
+
144
229
  - No breaking changes.
145
230
 
146
231
  ## [2.2.5] - 2025-09-18
232
+
147
233
  ### Added
234
+
148
235
  - Updated README with `--strict` flag documentation.
149
236
 
150
237
  ### Fixed
238
+
151
239
  - Fixed false positives for HTTPS URLs in SVG files and SVG namespace URLs.
152
240
 
153
241
  ### Changed
242
+
154
243
  - No breaking changes.
155
244
 
156
245
  ## [2.2.4] - 2025-09-13
246
+
157
247
  ### Fixed
248
+
158
249
  - Fixed found variable count did not show when there were missing variables in .env
159
250
  - Will now not says "Found 2 unique environment variables in use" if there are found in commented out code.
160
251
  - Fixed bug where it would say "no unused variables" if there where no found variables at all.
161
252
 
162
253
  ### Changed
254
+
163
255
  - No breaking changes.
164
256
 
165
257
  ## [2.2.3] - 2025-09-08
258
+
166
259
  ### Added
260
+
167
261
  - Warning for HTTPS URLs detected in codebase.
168
262
  - Added duplicate key detection to codebase scanner.
169
263
  - added `--strict` flag to enable strict mode (treat warnings as errors).
170
264
  - duplicate key detection for `.env.example` files.
171
265
 
172
266
  ### Fixed
267
+
173
268
  - Fixed issue with false warnings on secrets in certain edge cases.
174
269
  - Updated README
175
270
 
176
271
  ### Changed
272
+
177
273
  - No breaking changes.
178
274
  - `--compare` feature coloring improved for better readability.
179
275
  - added `duplicate` warnings to scan results.
180
276
 
181
277
  ## [2.2.2] - 2025-09-07
278
+
182
279
  ### Fixed
280
+
183
281
  - Fixed issue where it would give a false warning on secrets with process.env
184
282
  - Code cleanup.
185
283
  - exclude `.svelte-kit` from codebase scan by default.
186
284
  - Updated README
187
285
 
188
286
  ### Changed
287
+
189
288
  - No breaking changes.
190
289
 
191
290
  ## [2.2.1] - 2025-09-06
291
+
192
292
  ### Changed
293
+
193
294
  - tsconfig updates for improved type checking.
194
295
  - Updated codebase for new tsconfig rules
195
296
  - No breaking changes.
196
297
 
197
298
  ### Added
299
+
198
300
  - Improved jsDocs for better code documentation.
199
301
 
200
302
  ## [2.2.0] - 2025-08-30
303
+
201
304
  ### Added
305
+
202
306
  - `--compare` flag to enable comparison mode.
203
307
  - `dotenv-diff` will now detect potential secrets in your codebase.
204
308
 
205
309
  ### Changed
310
+
206
311
  - Default behavior is now **scan-usage** (you no longer need `--scan-usage`), but you can still use it for clarity.
207
312
  - `--compare` flag is now required for all comparison operations.
208
313
 
209
-
210
314
  ## [2.1.7] - 2025-08-28
315
+
211
316
  ### Added
317
+
212
318
  - gif to README file.
213
319
 
214
320
  ### Changed
321
+
215
322
  - No breaking changes. Existing functionality remains intact.
216
323
 
217
324
  ## [2.1.6] - 2025-08-26
325
+
218
326
  ### fixed
327
+
219
328
  - Fixed issue where prompts were disabled when using `--env` and `--example` flags.
220
329
 
221
330
  ## Changed
331
+
222
332
  - No breaking changes. Existing functionality remains intact.
223
333
 
224
334
  ## [2.1.5] - 2025-08-25
335
+
225
336
  ### Added
337
+
226
338
  - Added `--no-color` option to disable colored output.
227
339
 
228
340
  ### Changed
341
+
229
342
  - No breaking changes. Existing functionality remains intact.
230
343
 
231
344
  ## [2.1.4] - 2025-08-19
345
+
232
346
  ### Added
347
+
233
348
  - the `--fix` flag to automatically fix common issues:
234
349
  - Remove duplicate keys (keeping the last occurrence).
235
350
  - Add missing keys from the example file with empty values.
236
351
 
237
352
  ### Changed
353
+
238
354
  - No breaking changes. Existing functionality remains intact.
239
355
 
240
356
  ## [2.1.3] - 2025-08-19
357
+
241
358
  ### Added
359
+
242
360
  - Added `.sveltekit` and `_actions` to default exclude patterns in codebase scanner.
243
361
 
244
362
  ### Changed
363
+
245
364
  - No breaking changes. Existing functionality remains intact.
246
365
 
247
366
  ### Fixed
367
+
248
368
  - Fixed issue where `--include-files` and `--exclude-files` were not properly documented in README.
249
369
 
250
370
  ## [2.1.2] - 2025-08-16
371
+
251
372
  ### Changed
373
+
252
374
  - Updated README with Turborepo usage example.
253
375
 
254
376
  ## [2.1.1] - 2025-08-16
377
+
255
378
  ### Added
379
+
256
380
  - `--files` option to **completely override** the default file patterns.
257
381
  Useful for including files that are normally excluded (e.g. `*.test.js`).
258
382
 
259
383
  ### Changed
260
- - Clarified behavior of `--include-files`: now explicitly extends the default patterns instead of replacing them.
384
+
385
+ - Clarified behavior of `--include-files`: now explicitly extends the default patterns instead of replacing them.
261
386
  - Updated README with usage examples for `--files`, `--include-files`, and `--exclude-files`.
262
387
 
263
388
  ## [2.1.0] - 2025-08-15
389
+
264
390
  ### Added
391
+
265
392
  - `--ci` option for non-interactive mode in CI environments.
266
393
 
267
394
  ### Changed
395
+
268
396
  - No breaking changes. Existing functionality remains intact.
269
397
 
270
398
  ## [2.0.0] - 2025-08-14
399
+
271
400
  ### Added
401
+
272
402
  - `--scan-usage` option to scan codebase for environment variable usage.
273
403
  - `--include-files` and `--exclude-files` options to specify which files to include or exclude from the scan.
274
404
  - `--show-unused` option to display variables defined in `.env` but not used in code.
275
405
  - `--show-stats` option to display scan statistics.
276
406
 
277
407
  ### Changed
408
+
278
409
  - No breaking changes. Existing functionality remains intact.
279
410
 
280
411
  ## [1.6.5] - 2025-08-13
412
+
281
413
  ### Added
414
+
282
415
  - `--only` flag to restrict output to specific categories (e.g., `missing`, `extra`, `empty`, `mismatches`, `duplicates`, `gitignore`).
283
416
 
284
417
  ## [1.6.4] - 2025-08-12
418
+
285
419
  ### Added
420
+
286
421
  - `--ignore` and `--ignore-regex` options to specify files or directories to ignore during comparison.
287
422
 
288
423
  ## [1.6.3] - 2025-08-11
424
+
289
425
  ### Added
426
+
290
427
  - `--json` option to output results in JSON format. (Non-breaking)
291
428
 
292
429
  ## [1.6.2] - 2025-08-10
430
+
293
431
  ### Added
432
+
294
433
  - Duplicate key detection for `.env*` files.
295
434
  - Prints warnings listing duplicate keys (last occurrence wins).
296
435
  - Suppress via `--allow-duplicates`.
297
436
 
298
437
  ### Changed
438
+
299
439
  - No breaking changes. Exit codes and diff behavior unchanged.
300
440
 
301
441
  ## [1.6.1] - 2025-08-09
442
+
302
443
  ### Build
444
+
303
445
  - Updated TypeScript configuration to include `bin` directory.
304
446
  - Switched CLI path to `bin/dotenv-diff.js` for consistency.
305
447
  - Refactored folder structure for better organization.
306
448
 
307
449
  ## [1.6.0] - 2025-08-08
450
+
308
451
  ### Added
452
+
309
453
  - `--env` and `--example` for direct file comparison; autoscan overridden when both are provided.
310
454
 
311
455
  ## [1.5.0] - 2025-08-07
456
+
312
457
  ### Added
458
+
313
459
  - Non-interactive modes: `--ci` and `--yes`.