dotenv-diff 2.2.6 → 2.2.8
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/README.md +11 -0
- package/dist/src/cli/run.d.ts.map +1 -1
- package/dist/src/cli/run.js +133 -102
- package/dist/src/cli/run.js.map +1 -1
- package/dist/src/commands/compare.d.ts +2 -20
- package/dist/src/commands/compare.d.ts.map +1 -1
- package/dist/src/commands/compare.js +107 -173
- package/dist/src/commands/compare.js.map +1 -1
- package/dist/src/commands/scanUsage.d.ts.map +1 -1
- package/dist/src/commands/scanUsage.js +61 -182
- package/dist/src/commands/scanUsage.js.map +1 -1
- package/dist/src/config/loadConfig.d.ts +2 -0
- package/dist/src/config/loadConfig.d.ts.map +1 -0
- package/dist/src/config/options.d.ts.map +1 -1
- package/dist/src/config/options.js +42 -32
- package/dist/src/config/options.js.map +1 -1
- package/dist/src/config/types.d.ts +58 -0
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/core/fixEnv.d.ts +23 -15
- package/dist/src/core/fixEnv.d.ts.map +1 -1
- package/dist/src/core/fixEnv.js +70 -11
- package/dist/src/core/fixEnv.js.map +1 -1
- package/dist/src/core/helpers/isAllOk.d.ts +8 -0
- package/dist/src/core/helpers/isAllOk.d.ts.map +1 -0
- package/dist/src/core/helpers/isAllOk.js +15 -0
- package/dist/src/core/helpers/isAllOk.js.map +1 -0
- package/dist/src/core/helpers/updateTotals.d.ts +20 -0
- package/dist/src/core/helpers/updateTotals.d.ts.map +1 -0
- package/dist/src/core/helpers/updateTotals.js +37 -0
- package/dist/src/core/helpers/updateTotals.js.map +1 -0
- package/dist/src/core/processComparisonFile.d.ts +36 -0
- package/dist/src/core/processComparisonFile.d.ts.map +1 -0
- package/dist/src/core/processComparisonFile.js +124 -0
- package/dist/src/core/processComparisonFile.js.map +1 -0
- package/dist/src/core/secretDetectors.d.ts.map +1 -1
- package/dist/src/core/secretDetectors.js +13 -0
- package/dist/src/core/secretDetectors.js.map +1 -1
- package/dist/src/services/ensureFilesOrPrompt.d.ts +19 -0
- package/dist/src/services/ensureFilesOrPrompt.d.ts.map +1 -0
- package/dist/src/services/ensureFilesOrPrompt.js +73 -0
- package/dist/src/services/ensureFilesOrPrompt.js.map +1 -0
- package/dist/src/services/git.d.ts +9 -0
- package/dist/src/services/git.d.ts.map +1 -1
- package/dist/src/services/git.js +46 -3
- package/dist/src/services/git.js.map +1 -1
- package/dist/src/services/scanOutputToConsole.d.ts +6 -1
- package/dist/src/services/scanOutputToConsole.d.ts.map +1 -1
- package/dist/src/services/scanOutputToConsole.js +71 -112
- package/dist/src/services/scanOutputToConsole.js.map +1 -1
- package/dist/src/ui/compare/printAutoFix.d.ts +16 -0
- package/dist/src/ui/compare/printAutoFix.d.ts.map +1 -0
- package/dist/src/ui/compare/printAutoFix.js +34 -0
- package/dist/src/ui/compare/printAutoFix.js.map +1 -0
- package/dist/src/ui/compare/printAutoFixApplied.d.ts +7 -0
- package/dist/src/ui/compare/printAutoFixApplied.d.ts.map +1 -0
- package/dist/src/ui/compare/printAutoFixApplied.js +22 -0
- package/dist/src/ui/compare/printAutoFixApplied.js.map +1 -0
- package/dist/src/ui/compare/printDuplicates.d.ts +17 -0
- package/dist/src/ui/compare/printDuplicates.d.ts.map +1 -0
- package/dist/src/ui/compare/printDuplicates.js +25 -0
- package/dist/src/ui/compare/printDuplicates.js.map +1 -0
- package/dist/src/ui/compare/printErrorNotFound.d.ts +9 -0
- package/dist/src/ui/compare/printErrorNotFound.d.ts.map +1 -0
- package/dist/src/ui/compare/printErrorNotFound.js +18 -0
- package/dist/src/ui/compare/printErrorNotFound.js.map +1 -0
- package/dist/src/ui/compare/printFixTips.d.ts +11 -0
- package/dist/src/ui/compare/printFixTips.d.ts.map +1 -0
- package/dist/src/ui/compare/printFixTips.js +46 -0
- package/dist/src/ui/compare/printFixTips.js.map +1 -0
- package/dist/src/ui/compare/printHeader.d.ts +10 -0
- package/dist/src/ui/compare/printHeader.d.ts.map +1 -0
- package/dist/src/ui/compare/printHeader.js +20 -0
- package/dist/src/ui/compare/printHeader.js.map +1 -0
- package/dist/src/ui/compare/printIssues.d.ts +9 -0
- package/dist/src/ui/compare/printIssues.d.ts.map +1 -0
- package/dist/src/ui/compare/printIssues.js +34 -0
- package/dist/src/ui/compare/printIssues.js.map +1 -0
- package/dist/src/ui/compare/printPrompt.d.ts +11 -0
- package/dist/src/ui/compare/printPrompt.d.ts.map +1 -0
- package/dist/src/ui/compare/printPrompt.js +24 -0
- package/dist/src/ui/compare/printPrompt.js.map +1 -0
- package/dist/src/ui/compare/printStats.d.ts +19 -0
- package/dist/src/ui/compare/printStats.d.ts.map +1 -0
- package/dist/src/ui/compare/printStats.js +30 -0
- package/dist/src/ui/compare/printStats.js.map +1 -0
- package/dist/src/ui/compare/printSuccess.d.ts +11 -0
- package/dist/src/ui/compare/printSuccess.d.ts.map +1 -0
- package/dist/src/ui/compare/printSuccess.js +27 -0
- package/dist/src/ui/compare/printSuccess.js.map +1 -0
- package/dist/src/ui/scan/printComparisonError.d.ts +11 -0
- package/dist/src/ui/scan/printComparisonError.d.ts.map +1 -0
- package/dist/src/ui/scan/printComparisonError.js +20 -0
- package/dist/src/ui/scan/printComparisonError.js.map +1 -0
- package/dist/src/ui/scan/printHeader.d.ts +7 -0
- package/dist/src/ui/scan/printHeader.d.ts.map +1 -0
- package/dist/src/ui/scan/printHeader.js +16 -0
- package/dist/src/ui/scan/printHeader.js.map +1 -0
- package/dist/src/ui/scan/printMissing.d.ts +13 -0
- package/dist/src/ui/scan/printMissing.d.ts.map +1 -0
- package/dist/src/ui/scan/printMissing.js +43 -0
- package/dist/src/ui/scan/printMissing.js.map +1 -0
- package/dist/src/ui/scan/printMissingExample.d.ts +9 -0
- package/dist/src/ui/scan/printMissingExample.d.ts.map +1 -0
- package/dist/src/ui/scan/printMissingExample.js +27 -0
- package/dist/src/ui/scan/printMissingExample.js.map +1 -0
- package/dist/src/ui/scan/printSecrets.d.ts +14 -0
- package/dist/src/ui/scan/printSecrets.d.ts.map +1 -0
- package/dist/src/ui/scan/printSecrets.js +29 -0
- package/dist/src/ui/scan/printSecrets.js.map +1 -0
- package/dist/src/ui/scan/printStats.d.ts +13 -0
- package/dist/src/ui/scan/printStats.d.ts.map +1 -0
- package/dist/src/ui/scan/printStats.js +17 -0
- package/dist/src/ui/scan/printStats.js.map +1 -0
- package/dist/src/ui/scan/printUniqueVariables.d.ts +7 -0
- package/dist/src/ui/scan/printUniqueVariables.d.ts.map +1 -0
- package/dist/src/ui/scan/printUniqueVariables.js +14 -0
- package/dist/src/ui/scan/printUniqueVariables.js.map +1 -0
- package/dist/src/ui/scan/printUnused.d.ts +10 -0
- package/dist/src/ui/scan/printUnused.d.ts.map +1 -0
- package/dist/src/ui/scan/printUnused.js +22 -0
- package/dist/src/ui/scan/printUnused.js.map +1 -0
- package/dist/src/ui/scan/printVariables.d.ts +10 -0
- package/dist/src/ui/scan/printVariables.d.ts.map +1 -0
- package/dist/src/ui/scan/printVariables.js +37 -0
- package/dist/src/ui/scan/printVariables.js.map +1 -0
- package/dist/src/ui/shared/printAutoFix.d.ts +16 -0
- package/dist/src/ui/shared/printAutoFix.d.ts.map +1 -0
- package/dist/src/ui/shared/printAutoFix.js +34 -0
- package/dist/src/ui/shared/printAutoFix.js.map +1 -0
- package/dist/src/ui/shared/printDuplicates.d.ts +17 -0
- package/dist/src/ui/shared/printDuplicates.d.ts.map +1 -0
- package/dist/src/ui/shared/printDuplicates.js +25 -0
- package/dist/src/ui/shared/printDuplicates.js.map +1 -0
- package/dist/src/ui/shared/printFixTips.d.ts +11 -0
- package/dist/src/ui/shared/printFixTips.d.ts.map +1 -0
- package/dist/src/ui/shared/printFixTips.js +46 -0
- package/dist/src/ui/shared/printFixTips.js.map +1 -0
- package/dist/src/ui/shared/printGitignore.d.ts +13 -0
- package/dist/src/ui/shared/printGitignore.d.ts.map +1 -0
- package/dist/src/ui/shared/printGitignore.js +22 -0
- package/dist/src/ui/shared/printGitignore.js.map +1 -0
- package/dist/src/ui/shared/printOptionErrors.d.ts +17 -0
- package/dist/src/ui/shared/printOptionErrors.d.ts.map +1 -0
- package/dist/src/ui/shared/printOptionErrors.js +27 -0
- package/dist/src/ui/shared/printOptionErrors.js.map +1 -0
- package/dist/src/ui/shared/printStrictModeError.d.ts +16 -0
- package/dist/src/ui/shared/printStrictModeError.d.ts.map +1 -0
- package/dist/src/ui/shared/printStrictModeError.js +29 -0
- package/dist/src/ui/shared/printStrictModeError.js.map +1 -0
- package/dist/src/ui/shared/printSuccess.d.ts +11 -0
- package/dist/src/ui/shared/printSuccess.d.ts.map +1 -0
- package/dist/src/ui/shared/printSuccess.js +27 -0
- package/dist/src/ui/shared/printSuccess.js.map +1 -0
- package/dist/src/ui/shared/setupGlobalConfig.d.ts +7 -0
- package/dist/src/ui/shared/setupGlobalConfig.d.ts.map +1 -0
- package/dist/src/ui/shared/setupGlobalConfig.js +12 -0
- package/dist/src/ui/shared/setupGlobalConfig.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -82,6 +82,17 @@ You can use the `--strict` flag to treat all warnings as errors. This is useful
|
|
|
82
82
|
dotenv-diff --strict
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
## ignore specific warnings
|
|
86
|
+
|
|
87
|
+
You can use the `dotenv-diff-ignore` comment to ignore specific lines from secret detection. For example:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
const secret ="https://thisurlshouldbeignored.com"; // dotenv-diff-ignore
|
|
91
|
+
const ignoredEntropy = "AIzaSyA-1234567890abcdefgHIJKLMNOpqrstuv" // dotenv-diff-ignore;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This will prevent `dotenv-diff` from flagging the line as a potential secret.
|
|
95
|
+
|
|
85
96
|
## Show unused variables
|
|
86
97
|
|
|
87
98
|
As default, `dotenv-diff` will list variables that are defined in `.env` but never used in your codebase.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgMzC;;;GAGG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,iBAYzC"}
|
package/dist/src/cli/run.js
CHANGED
|
@@ -1,125 +1,135 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
3
|
import { normalizeOptions } from '../config/options.js';
|
|
5
4
|
import { discoverEnvFiles } from '../services/envDiscovery.js';
|
|
6
5
|
import { pairWithExample } from '../services/envPairing.js';
|
|
7
|
-
import { ensureFilesOrPrompt } from '../
|
|
6
|
+
import { ensureFilesOrPrompt } from '../services/ensureFilesOrPrompt.js';
|
|
8
7
|
import { compareMany } from '../commands/compare.js';
|
|
8
|
+
import {} from '../config/types.js';
|
|
9
9
|
import { scanUsage } from '../commands/scanUsage.js';
|
|
10
|
+
import { printErrorNotFound } from '../ui/compare/printErrorNotFound.js';
|
|
11
|
+
import { setupGlobalConfig } from '../ui/shared/setupGlobalConfig.js';
|
|
10
12
|
/**
|
|
11
|
-
* Run
|
|
12
|
-
* @param program The commander program instance
|
|
13
|
+
* Run scan-usage mode (default behavior)
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
process.exit(exitWithError ? 1 : 0);
|
|
42
|
-
}
|
|
43
|
-
// Special-case: both flags → direct comparison of exactly those two files
|
|
15
|
+
async function runScanMode(opts) {
|
|
16
|
+
const envPath = opts.envFlag || (fs.existsSync('.env') ? '.env' : undefined);
|
|
17
|
+
const { exitWithError } = await scanUsage({
|
|
18
|
+
cwd: opts.cwd,
|
|
19
|
+
include: opts.includeFiles,
|
|
20
|
+
exclude: opts.excludeFiles,
|
|
21
|
+
ignore: opts.ignore,
|
|
22
|
+
ignoreRegex: opts.ignoreRegex,
|
|
23
|
+
examplePath: opts.exampleFlag,
|
|
24
|
+
envPath,
|
|
25
|
+
fix: opts.fix,
|
|
26
|
+
json: opts.json,
|
|
27
|
+
showUnused: opts.showUnused,
|
|
28
|
+
showStats: opts.showStats,
|
|
29
|
+
isCiMode: opts.isCiMode,
|
|
30
|
+
secrets: opts.secrets,
|
|
31
|
+
strict: opts.strict ?? false,
|
|
32
|
+
...(opts.files ? { files: opts.files } : {}),
|
|
33
|
+
});
|
|
34
|
+
process.exit(exitWithError ? 1 : 0);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Run compare mode
|
|
38
|
+
*/
|
|
39
|
+
async function runCompareMode(opts) {
|
|
40
|
+
// Handle direct file comparison (both --env and --example specified)
|
|
44
41
|
if (opts.envFlag && opts.exampleFlag) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
process.exit(res.exitCode);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
// In CI mode, we just show errors and exit
|
|
67
|
-
if (!envExists) {
|
|
68
|
-
console.error(chalk.red(`❌ Error: --env file not found: ${path.basename(opts.envFlag)}`));
|
|
69
|
-
}
|
|
70
|
-
if (!exExists) {
|
|
71
|
-
console.error(chalk.red(`❌ Error: --example file not found: ${path.basename(opts.exampleFlag)}`));
|
|
72
|
-
}
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const report = [];
|
|
77
|
-
const { exitWithError } = await compareMany([
|
|
78
|
-
{
|
|
79
|
-
envName: path.basename(opts.envFlag),
|
|
80
|
-
envPath: opts.envFlag,
|
|
81
|
-
examplePath: opts.exampleFlag,
|
|
82
|
-
},
|
|
83
|
-
], {
|
|
84
|
-
checkValues: opts.checkValues,
|
|
85
|
-
cwd: opts.cwd,
|
|
86
|
-
allowDuplicates: opts.allowDuplicates,
|
|
87
|
-
json: opts.json,
|
|
88
|
-
ignore: opts.ignore,
|
|
89
|
-
ignoreRegex: opts.ignoreRegex,
|
|
90
|
-
showStats: opts.showStats,
|
|
91
|
-
collect: (e) => report.push(e),
|
|
92
|
-
...(opts.only ? { only: opts.only } : {}),
|
|
93
|
-
});
|
|
94
|
-
if (opts.json) {
|
|
95
|
-
console.log(JSON.stringify(report, null, 2));
|
|
96
|
-
}
|
|
97
|
-
process.exit(exitWithError ? 1 : 0);
|
|
42
|
+
await runDirectFileComparison(opts);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Handle auto-discovery comparison
|
|
46
|
+
await runAutoDiscoveryComparison(opts);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Compare two specific files directly
|
|
50
|
+
*/
|
|
51
|
+
async function runDirectFileComparison(opts) {
|
|
52
|
+
const envExists = fs.existsSync(opts.envFlag);
|
|
53
|
+
const exExists = fs.existsSync(opts.exampleFlag);
|
|
54
|
+
// Handle missing files
|
|
55
|
+
if (!envExists || !exExists) {
|
|
56
|
+
const shouldExit = await handleMissingFiles(opts, opts.envFlag, opts.exampleFlag);
|
|
57
|
+
if (shouldExit)
|
|
58
|
+
return;
|
|
98
59
|
}
|
|
99
|
-
//
|
|
100
|
-
const
|
|
60
|
+
// Perform comparison
|
|
61
|
+
const report = [];
|
|
62
|
+
const { exitWithError } = await compareMany([
|
|
63
|
+
{
|
|
64
|
+
envName: path.basename(opts.envFlag),
|
|
65
|
+
envPath: opts.envFlag,
|
|
66
|
+
examplePath: opts.exampleFlag,
|
|
67
|
+
},
|
|
68
|
+
], buildCompareOptions(opts, report));
|
|
69
|
+
outputResults(report, opts, exitWithError);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Compare using auto-discovery
|
|
73
|
+
*/
|
|
74
|
+
async function runAutoDiscoveryComparison(opts) {
|
|
75
|
+
// Discover available env files
|
|
76
|
+
const discovery = discoverEnvFiles({
|
|
101
77
|
cwd: opts.cwd,
|
|
102
78
|
envFlag: opts.envFlag ?? null,
|
|
103
79
|
exampleFlag: opts.exampleFlag ?? null,
|
|
104
80
|
});
|
|
105
|
-
//
|
|
106
|
-
const
|
|
107
|
-
cwd:
|
|
108
|
-
primaryEnv:
|
|
109
|
-
primaryExample:
|
|
110
|
-
alreadyWarnedMissingEnv:
|
|
81
|
+
// Ensure required files exist or prompt to create them
|
|
82
|
+
const initResult = await ensureFilesOrPrompt({
|
|
83
|
+
cwd: discovery.cwd,
|
|
84
|
+
primaryEnv: discovery.primaryEnv,
|
|
85
|
+
primaryExample: discovery.primaryExample,
|
|
86
|
+
alreadyWarnedMissingEnv: discovery.alreadyWarnedMissingEnv,
|
|
111
87
|
isYesMode: opts.isYesMode,
|
|
112
88
|
isCiMode: opts.isCiMode,
|
|
113
89
|
});
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
process.exit(res.exitCode);
|
|
90
|
+
if (initResult.shouldExit) {
|
|
91
|
+
outputResults([], opts, initResult.exitCode !== 0);
|
|
92
|
+
return;
|
|
118
93
|
}
|
|
119
94
|
// Compare all discovered pairs
|
|
120
|
-
const pairs = pairWithExample(
|
|
95
|
+
const pairs = pairWithExample(discovery);
|
|
121
96
|
const report = [];
|
|
122
|
-
const { exitWithError } = await compareMany(pairs,
|
|
97
|
+
const { exitWithError } = await compareMany(pairs, buildCompareOptions(opts, report));
|
|
98
|
+
outputResults(report, opts, exitWithError);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Handle missing files in CI vs interactive mode
|
|
102
|
+
*/
|
|
103
|
+
async function handleMissingFiles(opts, envFlag, exampleFlag) {
|
|
104
|
+
const envExists = fs.existsSync(envFlag);
|
|
105
|
+
const exExists = fs.existsSync(exampleFlag);
|
|
106
|
+
if (opts.isCiMode) {
|
|
107
|
+
// In CI mode, just show errors and exit
|
|
108
|
+
printErrorNotFound(envExists, exExists, envFlag, exampleFlag);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// Interactive mode - try to prompt for file creation
|
|
113
|
+
const result = await ensureFilesOrPrompt({
|
|
114
|
+
cwd: opts.cwd,
|
|
115
|
+
primaryEnv: envFlag,
|
|
116
|
+
primaryExample: exampleFlag,
|
|
117
|
+
alreadyWarnedMissingEnv: false,
|
|
118
|
+
isYesMode: opts.isYesMode,
|
|
119
|
+
isCiMode: opts.isCiMode,
|
|
120
|
+
});
|
|
121
|
+
if (result.shouldExit) {
|
|
122
|
+
outputResults([], opts, result.exitCode !== 0);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Build options object for compareMany function
|
|
130
|
+
*/
|
|
131
|
+
function buildCompareOptions(opts, report) {
|
|
132
|
+
return {
|
|
123
133
|
checkValues: opts.checkValues,
|
|
124
134
|
cwd: opts.cwd,
|
|
125
135
|
allowDuplicates: opts.allowDuplicates,
|
|
@@ -130,10 +140,31 @@ export async function run(program) {
|
|
|
130
140
|
showStats: opts.showStats,
|
|
131
141
|
collect: (e) => report.push(e),
|
|
132
142
|
...(opts.only ? { only: opts.only } : {}),
|
|
133
|
-
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Output results and exit with appropriate code
|
|
147
|
+
*/
|
|
148
|
+
function outputResults(report, opts, exitWithError) {
|
|
134
149
|
if (opts.json) {
|
|
135
150
|
console.log(JSON.stringify(report, null, 2));
|
|
136
151
|
}
|
|
137
152
|
process.exit(exitWithError ? 1 : 0);
|
|
138
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Run the CLI program
|
|
156
|
+
* @param program The commander program instance
|
|
157
|
+
*/
|
|
158
|
+
export async function run(program) {
|
|
159
|
+
program.parse(process.argv);
|
|
160
|
+
const opts = normalizeOptions(program.opts());
|
|
161
|
+
setupGlobalConfig(opts);
|
|
162
|
+
// Route to appropriate command
|
|
163
|
+
if (opts.compare) {
|
|
164
|
+
await runCompareMode(opts);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
await runScanMode(opts);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
139
170
|
//# sourceMappingURL=run.js.map
|
package/dist/src/cli/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/run.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/run.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC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AC;QACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAgB;IACxC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAE9C,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAExB,+BAA+B;IAC/B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComparisonOptions, FilePair, ComparisonResult } from '../config/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Compares multiple pairs of .env and .env.example files.
|
|
4
4
|
* @param pairs - The pairs of environment files to compare.
|
|
5
5
|
* @param opts - The comparison options.
|
|
6
6
|
* @returns An object indicating the overall comparison results.
|
|
7
7
|
*/
|
|
8
|
-
export declare function compareMany(pairs:
|
|
9
|
-
envName: string;
|
|
10
|
-
envPath: string;
|
|
11
|
-
examplePath: string;
|
|
12
|
-
}>, opts: {
|
|
13
|
-
checkValues: boolean;
|
|
14
|
-
cwd: string;
|
|
15
|
-
allowDuplicates?: boolean;
|
|
16
|
-
fix?: boolean;
|
|
17
|
-
json?: boolean;
|
|
18
|
-
ignore: string[];
|
|
19
|
-
ignoreRegex: RegExp[];
|
|
20
|
-
collect?: (entry: CompareJsonEntry) => void;
|
|
21
|
-
only?: Category[];
|
|
22
|
-
showStats?: boolean;
|
|
23
|
-
strict?: boolean;
|
|
24
|
-
}): Promise<{
|
|
25
|
-
exitWithError: boolean;
|
|
26
|
-
}>;
|
|
8
|
+
export declare function compareMany(pairs: FilePair[], opts: ComparisonOptions): Promise<ComparisonResult>;
|
|
27
9
|
//# sourceMappingURL=compare.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/commands/compare.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/commands/compare.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,iBAAiB,EACjB,QAAQ,EACR,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AA+F5B;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,QAAQ,EAAE,EACjB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAoK3B"}
|