@nmakarov/cli-toolkit 0.46.0 → 0.49.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.
@@ -1439,36 +1439,29 @@ var Args = class _Args {
1439
1439
  }
1440
1440
  return;
1441
1441
  }
1442
- let dotEnvPathFile = null;
1443
- const envSpecificFile = `.env.${this.env}`;
1444
- const envSpecificPath = resolve(dotEnvPath, envSpecificFile);
1445
- if (existsSync(envSpecificPath)) {
1446
- dotEnvPathFile = envSpecificPath;
1447
- }
1448
- if (!dotEnvPathFile && !this.get("dotEnvPath")) {
1442
+ let dotEnvPathFile = resolve(dotEnvPath, dotEnvFile);
1443
+ if (!existsSync(dotEnvPathFile) && !this.get("dotEnvPath")) {
1449
1444
  const examplesPath = resolve(dotEnvPath, "examples");
1450
- const examplesEnvSpecificPath = resolve(examplesPath, envSpecificFile);
1451
- if (existsSync(examplesEnvSpecificPath)) {
1452
- dotEnvPathFile = examplesEnvSpecificPath;
1453
- }
1454
- }
1455
- if (!dotEnvPathFile) {
1456
- dotEnvPathFile = resolve(dotEnvPath, dotEnvFile);
1457
- if (!existsSync(dotEnvPathFile)) {
1458
- if (!this.get("dotEnvPath")) {
1459
- const examplesPath = resolve(dotEnvPath, "examples");
1460
- const examplesEnvFile = resolve(examplesPath, dotEnvFile);
1461
- if (existsSync(examplesEnvFile)) {
1462
- dotEnvPathFile = examplesEnvFile;
1463
- } else {
1464
- dotEnvPathFile = resolve(dotEnvPath, "..", dotEnvFile);
1465
- }
1466
- }
1445
+ const examplesEnvFile = resolve(examplesPath, dotEnvFile);
1446
+ if (existsSync(examplesEnvFile)) {
1447
+ dotEnvPathFile = examplesEnvFile;
1448
+ } else {
1449
+ dotEnvPathFile = resolve(dotEnvPath, "..", dotEnvFile);
1467
1450
  }
1468
1451
  }
1469
1452
  if (dotEnvPathFile && existsSync(dotEnvPathFile)) {
1470
1453
  config({ path: dotEnvPathFile, quiet: true });
1471
1454
  }
1455
+ const envSpecificFile = `.env.${this.env}`;
1456
+ const envSpecificPath = resolve(dotEnvPath, envSpecificFile);
1457
+ if (existsSync(envSpecificPath) && envSpecificPath !== dotEnvPathFile) {
1458
+ config({ path: envSpecificPath, quiet: true });
1459
+ } else if (!this.get("dotEnvPath")) {
1460
+ const examplesOverlay = resolve(dotEnvPath, "examples", envSpecificFile);
1461
+ if (existsSync(examplesOverlay)) {
1462
+ config({ path: examplesOverlay, quiet: true });
1463
+ }
1464
+ }
1472
1465
  }
1473
1466
  /**
1474
1467
  * Load configuration files
@@ -2694,6 +2687,9 @@ async function init(flow2, opts = {}) {
2694
2687
  if (context) {
2695
2688
  await runRegisteredCleanups(context);
2696
2689
  }
2690
+ if (process.exitCode && process.exitCode !== 0) {
2691
+ process.exit(process.exitCode);
2692
+ }
2697
2693
  }
2698
2694
  }
2699
2695