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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Print all unique variables and their usage locations.
|
|
4
|
+
*
|
|
5
|
+
* @param usages - Array of environment variable usages
|
|
6
|
+
* @param showStats - Whether to show usage details (files/lines)
|
|
7
|
+
* @param json - Whether to output in JSON format
|
|
8
|
+
*/
|
|
9
|
+
export function printVariables(usages, showStats, json) {
|
|
10
|
+
if (json)
|
|
11
|
+
return;
|
|
12
|
+
if (usages.length === 0)
|
|
13
|
+
return;
|
|
14
|
+
// Group by variable
|
|
15
|
+
const variableUsages = usages.reduce((acc, usage) => {
|
|
16
|
+
if (!acc[usage.variable]) {
|
|
17
|
+
acc[usage.variable] = [];
|
|
18
|
+
}
|
|
19
|
+
acc[usage.variable].push(usage);
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
// Display each unique variable
|
|
23
|
+
for (const [variable, variableUsageList] of Object.entries(variableUsages)) {
|
|
24
|
+
console.log(chalk.blue(` ${variable}`));
|
|
25
|
+
if (showStats) {
|
|
26
|
+
const displayUsages = variableUsageList.slice(0, 2);
|
|
27
|
+
displayUsages.forEach((usage) => {
|
|
28
|
+
console.log(chalk.blue.dim(` Used in: ${usage.file}:${usage.line} (${usage.pattern})`));
|
|
29
|
+
});
|
|
30
|
+
if (variableUsageList.length > 2) {
|
|
31
|
+
console.log(chalk.gray(` ... and ${variableUsageList.length - 2} more locations`));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
console.log();
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=printVariables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printVariables.js","sourceRoot":"","sources":["../../../../src/ui/scan/printVariables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAkB,EAClB,SAAkB,EAClB,IAAa;IAEb,IAAI,IAAI;QAAE,OAAO;IACjB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEhC,oBAAoB;IACpB,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAClC,CAAC,GAAmB,EAAE,KAAe,EAAE,EAAE;QACvC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAC3B,CAAC;QACD,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;IAEF,+BAA+B;IAC/B,KAAK,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,QAAQ,EAAE,CAAC,CAAC,CAAC;QAE1C,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,aAAa,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAEpD,aAAa,CAAC,OAAO,CAAC,CAAC,KAAe,EAAE,EAAE;gBACxC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,IAAI,CAAC,GAAG,CACZ,iBAAiB,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,GAAG,CAC/D,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,IAAI,CACR,gBAAgB,iBAAiB,CAAC,MAAM,GAAG,CAAC,iBAAiB,CAC9D,CACF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AutoFixResult {
|
|
2
|
+
removedDuplicates: string[];
|
|
3
|
+
addedEnv: string[];
|
|
4
|
+
addedExample: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Prints the result of the auto-fix operation.
|
|
8
|
+
* @param changed - Whether any changes were made.
|
|
9
|
+
* @param result - The result of the auto-fix operation.
|
|
10
|
+
* @param envName - The name of the environment file.
|
|
11
|
+
* @param exampleName - The name of the example file.
|
|
12
|
+
* @param json - Whether to output in JSON format.
|
|
13
|
+
* @returns void
|
|
14
|
+
*/
|
|
15
|
+
export declare function printAutoFix(changed: boolean, result: AutoFixResult, envName: string, exampleName: string, json: boolean, gitignoreUpdated: boolean): void;
|
|
16
|
+
//# sourceMappingURL=printAutoFix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printAutoFix.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/printAutoFix.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,EACb,gBAAgB,EAAE,OAAO,GACxB,IAAI,CAiCN"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Prints the result of the auto-fix operation.
|
|
4
|
+
* @param changed - Whether any changes were made.
|
|
5
|
+
* @param result - The result of the auto-fix operation.
|
|
6
|
+
* @param envName - The name of the environment file.
|
|
7
|
+
* @param exampleName - The name of the example file.
|
|
8
|
+
* @param json - Whether to output in JSON format.
|
|
9
|
+
* @returns void
|
|
10
|
+
*/
|
|
11
|
+
export function printAutoFix(changed, result, envName, exampleName, json, gitignoreUpdated) {
|
|
12
|
+
if (json)
|
|
13
|
+
return;
|
|
14
|
+
if (changed) {
|
|
15
|
+
console.log(chalk.green('✅ Auto-fix applied:'));
|
|
16
|
+
if (result.removedDuplicates.length) {
|
|
17
|
+
console.log(chalk.green(` - Removed ${result.removedDuplicates.length} duplicate keys from ${envName}: ${result.removedDuplicates.join(', ')}`));
|
|
18
|
+
}
|
|
19
|
+
if (result.addedEnv.length) {
|
|
20
|
+
console.log(chalk.green(` - Added ${result.addedEnv.length} missing keys to ${envName}: ${result.addedEnv.join(', ')}`));
|
|
21
|
+
}
|
|
22
|
+
if (result.addedExample.length) {
|
|
23
|
+
console.log(chalk.green(` - Synced ${result.addedExample.length} keys to ${exampleName}: ${result.addedExample.join(', ')}`));
|
|
24
|
+
}
|
|
25
|
+
if (gitignoreUpdated) {
|
|
26
|
+
console.log(chalk.green(` - Added ${envName} to .gitignore`));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log(chalk.green('✅ Auto-fix applied: no changes needed.'));
|
|
31
|
+
}
|
|
32
|
+
console.log();
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=printAutoFix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printAutoFix.js","sourceRoot":"","sources":["../../../../src/ui/shared/printAutoFix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAgB,EAChB,MAAqB,EACrB,OAAe,EACf,WAAmB,EACnB,IAAa,EACb,gBAAyB;IAEzB,IAAI,IAAI;QAAE,OAAO;IAEjB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,eAAe,MAAM,CAAC,iBAAiB,CAAC,MAAM,wBAAwB,OAAO,KAAK,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxH,CACF,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,aAAa,MAAM,CAAC,QAAQ,CAAC,MAAM,oBAAoB,OAAO,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChG,CACF,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,cAAc,MAAM,CAAC,YAAY,CAAC,MAAM,YAAY,WAAW,KAAK,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACrG,CACF,CAAC;QACJ,CAAC;QACD,IAAI,gBAAgB,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints duplicate keys found in the environment and example files.
|
|
3
|
+
* @param envName The name of the environment file.
|
|
4
|
+
* @param exampleName The name of the example file.
|
|
5
|
+
* @param dEnv Array of duplicate keys in the environment file with their counts.
|
|
6
|
+
* @param dEx Array of duplicate keys in the example file with their counts.
|
|
7
|
+
* @param json Whether to output in JSON format.
|
|
8
|
+
* @returns void
|
|
9
|
+
*/
|
|
10
|
+
export declare function printDuplicates(envName: string, exampleName: string, dEnv: Array<{
|
|
11
|
+
key: string;
|
|
12
|
+
count: number;
|
|
13
|
+
}>, dEx: Array<{
|
|
14
|
+
key: string;
|
|
15
|
+
count: number;
|
|
16
|
+
}>, json: boolean): void;
|
|
17
|
+
//# sourceMappingURL=printDuplicates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printDuplicates.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/printDuplicates.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAC3C,GAAG,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1C,IAAI,EAAE,OAAO,QAuBd"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Prints duplicate keys found in the environment and example files.
|
|
4
|
+
* @param envName The name of the environment file.
|
|
5
|
+
* @param exampleName The name of the example file.
|
|
6
|
+
* @param dEnv Array of duplicate keys in the environment file with their counts.
|
|
7
|
+
* @param dEx Array of duplicate keys in the example file with their counts.
|
|
8
|
+
* @param json Whether to output in JSON format.
|
|
9
|
+
* @returns void
|
|
10
|
+
*/
|
|
11
|
+
export function printDuplicates(envName, exampleName, dEnv, dEx, json) {
|
|
12
|
+
if (json)
|
|
13
|
+
return;
|
|
14
|
+
if (dEnv.length) {
|
|
15
|
+
console.log(chalk.yellow(`⚠️ Duplicate keys in ${envName} (last occurrence wins):`));
|
|
16
|
+
dEnv.forEach(({ key, count }) => console.log(chalk.yellow(` - ${key} (${count} occurrences)`)));
|
|
17
|
+
console.log();
|
|
18
|
+
}
|
|
19
|
+
if (dEx.length) {
|
|
20
|
+
console.log(chalk.yellow(`⚠️ Duplicate keys in ${exampleName} (last occurrence wins):`));
|
|
21
|
+
dEx.forEach(({ key, count }) => console.log(chalk.yellow(` - ${key} (${count} occurrences)`)));
|
|
22
|
+
console.log();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=printDuplicates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printDuplicates.js","sourceRoot":"","sources":["../../../../src/ui/shared/printDuplicates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,WAAmB,EACnB,IAA2C,EAC3C,GAA0C,EAC1C,IAAa;IAEb,IAAI,IAAI;QAAE,OAAO;IACjB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CAAC,yBAAyB,OAAO,0BAA0B,CAAC,CACzE,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,KAAK,KAAK,eAAe,CAAC,CAAC,CACjE,CAAC;QACF,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CACV,yBAAyB,WAAW,0BAA0B,CAC/D,CACF,CAAC;QACF,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK,KAAK,eAAe,CAAC,CAAC,CAChE,CAAC;QACF,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Filtered } from '../../config/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Prints tips for fixing issues found during the comparison.
|
|
4
|
+
* @param filtered The filtered comparison results.
|
|
5
|
+
* @param envNotIgnored Whether the .env file is not ignored by git.
|
|
6
|
+
* @param json Whether to output in JSON format.
|
|
7
|
+
* @param fix Whether to apply fixes.
|
|
8
|
+
* @returns void
|
|
9
|
+
*/
|
|
10
|
+
export declare function printFixTips(filtered: Filtered, envNotIgnored: boolean, json: boolean, fix: boolean): void;
|
|
11
|
+
//# sourceMappingURL=printFixTips.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printFixTips.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/printFixTips.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,OAAO,QA+Bb"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import {} from '../../config/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Prints tips for fixing issues found during the comparison.
|
|
5
|
+
* @param filtered The filtered comparison results.
|
|
6
|
+
* @param envNotIgnored Whether the .env file is not ignored by git.
|
|
7
|
+
* @param json Whether to output in JSON format.
|
|
8
|
+
* @param fix Whether to apply fixes.
|
|
9
|
+
* @returns void
|
|
10
|
+
*/
|
|
11
|
+
export function printFixTips(filtered, envNotIgnored, json, fix) {
|
|
12
|
+
if (json || fix)
|
|
13
|
+
return;
|
|
14
|
+
const hasMissing = filtered.missing.length > 0;
|
|
15
|
+
const hasDupEnv = filtered.duplicatesEnv.length > 0;
|
|
16
|
+
let tip = null;
|
|
17
|
+
if (hasMissing && hasDupEnv && envNotIgnored) {
|
|
18
|
+
tip =
|
|
19
|
+
'💡 Tip: Run with `--fix` to add missing keys, remove duplicates and add .env to .gitignore';
|
|
20
|
+
}
|
|
21
|
+
else if (hasMissing && hasDupEnv) {
|
|
22
|
+
tip = '💡 Tip: Run with `--fix` to add missing keys and remove duplicates';
|
|
23
|
+
}
|
|
24
|
+
else if (hasDupEnv && envNotIgnored) {
|
|
25
|
+
tip =
|
|
26
|
+
'💡 Tip: Run with `--fix` to remove duplicate keys and add .env to .gitignore';
|
|
27
|
+
}
|
|
28
|
+
else if (hasMissing && envNotIgnored) {
|
|
29
|
+
tip =
|
|
30
|
+
'💡 Tip: Run with `--fix` to add missing keys and add .env to .gitignore';
|
|
31
|
+
}
|
|
32
|
+
else if (hasMissing) {
|
|
33
|
+
tip = '💡 Tip: Run with `--fix` to add missing keys';
|
|
34
|
+
}
|
|
35
|
+
else if (hasDupEnv) {
|
|
36
|
+
tip = '💡 Tip: Run with `--fix` to remove duplicate keys';
|
|
37
|
+
}
|
|
38
|
+
else if (envNotIgnored) {
|
|
39
|
+
tip = '💡 Tip: Run with `--fix` to ensure .env is added to .gitignore';
|
|
40
|
+
}
|
|
41
|
+
if (tip) {
|
|
42
|
+
console.log(chalk.gray(tip));
|
|
43
|
+
console.log();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=printFixTips.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printFixTips.js","sourceRoot":"","sources":["../../../../src/ui/shared/printFixTips.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAiB,MAAM,uBAAuB,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAkB,EAClB,aAAsB,EACtB,IAAa,EACb,GAAY;IAEZ,IAAI,IAAI,IAAI,GAAG;QAAE,OAAO;IAExB,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAEpD,IAAI,GAAG,GAAkB,IAAI,CAAC;IAC9B,IAAI,UAAU,IAAI,SAAS,IAAI,aAAa,EAAE,CAAC;QAC7C,GAAG;YACD,4FAA4F,CAAC;IACjG,CAAC;SAAM,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;QACnC,GAAG,GAAG,oEAAoE,CAAC;IAC7E,CAAC;SAAM,IAAI,SAAS,IAAI,aAAa,EAAE,CAAC;QACtC,GAAG;YACD,8EAA8E,CAAC;IACnF,CAAC;SAAM,IAAI,UAAU,IAAI,aAAa,EAAE,CAAC;QACvC,GAAG;YACD,yEAAyE,CAAC;IAC9E,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACtB,GAAG,GAAG,8CAA8C,CAAC;IACvD,CAAC;SAAM,IAAI,SAAS,EAAE,CAAC;QACrB,GAAG,GAAG,mDAAmD,CAAC;IAC5D,CAAC;SAAM,IAAI,aAAa,EAAE,CAAC;QACzB,GAAG,GAAG,gEAAgE,CAAC;IACzE,CAAC;IAED,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7B,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type GitignoreWarningOptions = {
|
|
2
|
+
envFile: string;
|
|
3
|
+
reason: 'no-gitignore' | 'not-ignored';
|
|
4
|
+
log?: (msg: string) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Logs a warning about .env not being ignored by Git.
|
|
8
|
+
* @param options - Options for the gitignore warning.
|
|
9
|
+
* @returns void
|
|
10
|
+
*/
|
|
11
|
+
export declare function printGitignoreWarning(options: GitignoreWarningOptions): void;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=printGitignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printGitignore.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/printGitignore.ts"],"names":[],"mappings":"AAEA,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,cAAc,GAAG,aAAa,CAAC;IACvC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAsB5E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Logs a warning about .env not being ignored by Git.
|
|
4
|
+
* @param options - Options for the gitignore warning.
|
|
5
|
+
* @returns void
|
|
6
|
+
*/
|
|
7
|
+
export function printGitignoreWarning(options) {
|
|
8
|
+
const { envFile, reason, log = console.log } = options;
|
|
9
|
+
if (reason === 'no-gitignore') {
|
|
10
|
+
log(chalk.yellow(`⚠️ No .gitignore found – your ${envFile} may be committed.\n` +
|
|
11
|
+
` Add:\n` +
|
|
12
|
+
` ${envFile}\n` +
|
|
13
|
+
` ${envFile}.*\n`));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
log(chalk.yellow(`⚠️ ${envFile} is not ignored by Git (.gitignore).\n` +
|
|
17
|
+
` Consider adding:\n` +
|
|
18
|
+
` ${envFile}\n` +
|
|
19
|
+
` ${envFile}.*\n`));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=printGitignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printGitignore.js","sourceRoot":"","sources":["../../../../src/ui/shared/printGitignore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgC;IACpE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC;IAEvD,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;QAC9B,GAAG,CACD,KAAK,CAAC,MAAM,CACV,kCAAkC,OAAO,sBAAsB;YAC7D,WAAW;YACX,QAAQ,OAAO,IAAI;YACnB,QAAQ,OAAO,MAAM,CACxB,CACF,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,GAAG,CACD,KAAK,CAAC,MAAM,CACV,OAAO,OAAO,wCAAwC;YACpD,uBAAuB;YACvB,QAAQ,OAAO,IAAI;YACnB,QAAQ,OAAO,MAAM,CACxB,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints an error for invalid --only categories and exits.
|
|
3
|
+
* @param flagName - The name of the flag.
|
|
4
|
+
* @param bad - The invalid values.
|
|
5
|
+
* @param allowed - The allowed values.
|
|
6
|
+
*/
|
|
7
|
+
export declare function printInvalidCategory(flagName: string, bad: string[], allowed: readonly string[]): never;
|
|
8
|
+
/**
|
|
9
|
+
* Prints an error for invalid regex patterns and exits.
|
|
10
|
+
* @param pattern - The invalid regex pattern.
|
|
11
|
+
*/
|
|
12
|
+
export declare function printInvalidRegex(pattern: string): never;
|
|
13
|
+
/**
|
|
14
|
+
* Prints a warning when both --ci and --yes are provided.
|
|
15
|
+
*/
|
|
16
|
+
export declare function printCiYesWarning(): void;
|
|
17
|
+
//# sourceMappingURL=printOptionErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printOptionErrors.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/printOptionErrors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,KAAK,CAQP;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAKxD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Prints an error for invalid --only categories and exits.
|
|
4
|
+
* @param flagName - The name of the flag.
|
|
5
|
+
* @param bad - The invalid values.
|
|
6
|
+
* @param allowed - The allowed values.
|
|
7
|
+
*/
|
|
8
|
+
export function printInvalidCategory(flagName, bad, allowed) {
|
|
9
|
+
console.error(chalk.red(`❌ Error: invalid ${flagName} value(s): ${bad.join(', ')}.\n` +
|
|
10
|
+
` Allowed: ${allowed.join(', ')}`));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Prints an error for invalid regex patterns and exits.
|
|
15
|
+
* @param pattern - The invalid regex pattern.
|
|
16
|
+
*/
|
|
17
|
+
export function printInvalidRegex(pattern) {
|
|
18
|
+
console.error(chalk.red(`❌ Error: invalid --ignore-regex pattern: ${pattern}`));
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Prints a warning when both --ci and --yes are provided.
|
|
23
|
+
*/
|
|
24
|
+
export function printCiYesWarning() {
|
|
25
|
+
console.log(chalk.yellow('⚠️ Both --ci and --yes provided; proceeding with --yes.'));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=printOptionErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printOptionErrors.js","sourceRoot":"","sources":["../../../../src/ui/shared/printOptionErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB,EAChB,GAAa,EACb,OAA0B;IAE1B,OAAO,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CACP,oBAAoB,QAAQ,cAAc,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;QAC3D,eAAe,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACtC,CACF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CAAC,4CAA4C,OAAO,EAAE,CAAC,CACjE,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CAAC,0DAA0D,CAAC,CACzE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface StrictModeContext {
|
|
2
|
+
unused: number;
|
|
3
|
+
duplicatesEnv: number;
|
|
4
|
+
duplicatesEx: number;
|
|
5
|
+
secrets: number;
|
|
6
|
+
hasGitignoreIssue: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Prints a strict-mode error if warnings exist.
|
|
10
|
+
*
|
|
11
|
+
* @param ctx - Counts of warnings/issues
|
|
12
|
+
* @param json - Whether to output in JSON format
|
|
13
|
+
* @returns true if exitWithError should be set
|
|
14
|
+
*/
|
|
15
|
+
export declare function printStrictModeError(ctx: StrictModeContext, json: boolean): boolean;
|
|
16
|
+
//# sourceMappingURL=printStrictModeError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printStrictModeError.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/printStrictModeError.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAE,OAAO,GACZ,OAAO,CAmBT"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Prints a strict-mode error if warnings exist.
|
|
4
|
+
*
|
|
5
|
+
* @param ctx - Counts of warnings/issues
|
|
6
|
+
* @param json - Whether to output in JSON format
|
|
7
|
+
* @returns true if exitWithError should be set
|
|
8
|
+
*/
|
|
9
|
+
export function printStrictModeError(ctx, json) {
|
|
10
|
+
if (json)
|
|
11
|
+
return false;
|
|
12
|
+
const warnings = [];
|
|
13
|
+
if (ctx.unused > 0)
|
|
14
|
+
warnings.push('unused variables');
|
|
15
|
+
if (ctx.duplicatesEnv > 0)
|
|
16
|
+
warnings.push('duplicate keys in env');
|
|
17
|
+
if (ctx.duplicatesEx > 0)
|
|
18
|
+
warnings.push('duplicate keys in example');
|
|
19
|
+
if (ctx.secrets > 0)
|
|
20
|
+
warnings.push('potential secrets');
|
|
21
|
+
if (ctx.hasGitignoreIssue)
|
|
22
|
+
warnings.push('.env not ignored by git');
|
|
23
|
+
if (warnings.length === 0)
|
|
24
|
+
return false;
|
|
25
|
+
console.log(chalk.red(`💥 Strict mode: Error on warnings → ${warnings.join(', ')}`));
|
|
26
|
+
console.log();
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=printStrictModeError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printStrictModeError.js","sourceRoot":"","sources":["../../../../src/ui/shared/printStrictModeError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAsB,EACtB,IAAa;IAEb,IAAI,IAAI;QAAE,OAAO,KAAK,CAAC;IAEvB,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACtD,IAAI,GAAG,CAAC,aAAa,GAAG,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAClE,IAAI,GAAG,CAAC,YAAY,GAAG,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACrE,IAAI,GAAG,CAAC,OAAO,GAAG,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACxD,IAAI,GAAG,CAAC,iBAAiB;QAAE,QAAQ,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAEpE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,uCAAuC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CACxE,CAAC;IACF,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints success messages when everything is OK.
|
|
3
|
+
*
|
|
4
|
+
* @param json - Whether to output in JSON format.
|
|
5
|
+
* @param mode - "compare" or "scan" mode.
|
|
6
|
+
* @param comparedAgainst - Name of env/example file (optional).
|
|
7
|
+
* @param unused - List of unused variables (optional, only for scan).
|
|
8
|
+
* @param showUnused - Whether to print unused success info.
|
|
9
|
+
*/
|
|
10
|
+
export declare function printSuccess(json: boolean, mode?: 'compare' | 'scan', comparedAgainst?: string, unused?: string[], showUnused?: boolean): void;
|
|
11
|
+
//# sourceMappingURL=printSuccess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printSuccess.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/printSuccess.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EACb,IAAI,GAAE,SAAS,GAAG,MAAkB,EACpC,eAAe,CAAC,EAAE,MAAM,EACxB,MAAM,GAAE,MAAM,EAAO,EACrB,UAAU,UAAQ,GACjB,IAAI,CAqBN"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Prints success messages when everything is OK.
|
|
4
|
+
*
|
|
5
|
+
* @param json - Whether to output in JSON format.
|
|
6
|
+
* @param mode - "compare" or "scan" mode.
|
|
7
|
+
* @param comparedAgainst - Name of env/example file (optional).
|
|
8
|
+
* @param unused - List of unused variables (optional, only for scan).
|
|
9
|
+
* @param showUnused - Whether to print unused success info.
|
|
10
|
+
*/
|
|
11
|
+
export function printSuccess(json, mode = 'compare', comparedAgainst, unused = [], showUnused = false) {
|
|
12
|
+
if (json)
|
|
13
|
+
return;
|
|
14
|
+
if (mode === 'compare') {
|
|
15
|
+
console.log(chalk.green('✅ All keys match.'));
|
|
16
|
+
console.log();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (mode === 'scan' && comparedAgainst) {
|
|
20
|
+
console.log(chalk.green(`✅ All used environment variables are defined in ${comparedAgainst}`));
|
|
21
|
+
if (showUnused && unused.length === 0) {
|
|
22
|
+
console.log(chalk.green('✅ No unused environment variables found'));
|
|
23
|
+
}
|
|
24
|
+
console.log();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=printSuccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printSuccess.js","sourceRoot":"","sources":["../../../../src/ui/shared/printSuccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAa,EACb,OAA2B,SAAS,EACpC,eAAwB,EACxB,SAAmB,EAAE,EACrB,UAAU,GAAG,KAAK;IAElB,IAAI,IAAI;QAAE,OAAO;IAEjB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,IAAI,IAAI,KAAK,MAAM,IAAI,eAAe,EAAE,CAAC;QACvC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,mDAAmD,eAAe,EAAE,CACrE,CACF,CAAC;QAEF,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupGlobalConfig.d.ts","sourceRoot":"","sources":["../../../../src/ui/shared/setupGlobalConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,QAI9C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import {} from '../../config/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @param opts - Options containing noColor flag
|
|
5
|
+
* @returns void
|
|
6
|
+
*/
|
|
7
|
+
export function setupGlobalConfig(opts) {
|
|
8
|
+
if (opts.noColor) {
|
|
9
|
+
chalk.level = 0; // disable colors globally
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=setupGlobalConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupGlobalConfig.js","sourceRoot":"","sources":["../../../../src/ui/shared/setupGlobalConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAgB,MAAM,uBAAuB,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,0BAA0B;IAC7C,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotenv-diff",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Scan your codebase to find environment variables in use.",
|
|
6
6
|
"bin": {
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"node": ">=20.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"chalk": "5.
|
|
60
|
+
"chalk": "5.6.2",
|
|
61
61
|
"commander": "^14.0.0",
|
|
62
62
|
"prompts": "^2.4.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@types/node": "^
|
|
65
|
+
"@types/node": "^24.5.2",
|
|
66
66
|
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
|
67
67
|
"@typescript-eslint/parser": "^8.39.0",
|
|
68
68
|
"eslint": "^9.32.0",
|