dotenv-diff 2.1.5 → 2.1.6
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/dist/src/cli/run.js +25 -5
- package/package.json +1 -1
package/dist/src/cli/run.js
CHANGED
|
@@ -37,14 +37,34 @@ export async function run(program) {
|
|
|
37
37
|
if (opts.envFlag && opts.exampleFlag) {
|
|
38
38
|
const envExists = fs.existsSync(opts.envFlag);
|
|
39
39
|
const exExists = fs.existsSync(opts.exampleFlag);
|
|
40
|
+
// Handle missing files with prompting (unless in CI mode)
|
|
40
41
|
if (!envExists || !exExists) {
|
|
41
|
-
if
|
|
42
|
-
|
|
42
|
+
// Check if we should prompt for file creation
|
|
43
|
+
if (!opts.isCiMode) {
|
|
44
|
+
const res = await ensureFilesOrPrompt({
|
|
45
|
+
cwd: opts.cwd,
|
|
46
|
+
primaryEnv: opts.envFlag,
|
|
47
|
+
primaryExample: opts.exampleFlag,
|
|
48
|
+
alreadyWarnedMissingEnv: false,
|
|
49
|
+
isYesMode: opts.isYesMode,
|
|
50
|
+
isCiMode: opts.isCiMode,
|
|
51
|
+
});
|
|
52
|
+
if (res.shouldExit) {
|
|
53
|
+
if (opts.json)
|
|
54
|
+
console.log(JSON.stringify([], null, 2));
|
|
55
|
+
process.exit(res.exitCode);
|
|
56
|
+
}
|
|
43
57
|
}
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
else {
|
|
59
|
+
// In CI mode, we just show errors and exit
|
|
60
|
+
if (!envExists) {
|
|
61
|
+
console.error(chalk.red(`❌ Error: --env file not found: ${path.basename(opts.envFlag)}`));
|
|
62
|
+
}
|
|
63
|
+
if (!exExists) {
|
|
64
|
+
console.error(chalk.red(`❌ Error: --example file not found: ${path.basename(opts.exampleFlag)}`));
|
|
65
|
+
}
|
|
66
|
+
process.exit(1);
|
|
46
67
|
}
|
|
47
|
-
process.exit(1);
|
|
48
68
|
}
|
|
49
69
|
const report = [];
|
|
50
70
|
const { exitWithError } = await compareMany([
|
package/package.json
CHANGED