@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.
package/dist/init.js CHANGED
@@ -1434,36 +1434,29 @@ var Args = class _Args {
1434
1434
  }
1435
1435
  return;
1436
1436
  }
1437
- let dotEnvPathFile = null;
1438
- const envSpecificFile = `.env.${this.env}`;
1439
- const envSpecificPath = resolve(dotEnvPath, envSpecificFile);
1440
- if (existsSync(envSpecificPath)) {
1441
- dotEnvPathFile = envSpecificPath;
1442
- }
1443
- if (!dotEnvPathFile && !this.get("dotEnvPath")) {
1437
+ let dotEnvPathFile = resolve(dotEnvPath, dotEnvFile);
1438
+ if (!existsSync(dotEnvPathFile) && !this.get("dotEnvPath")) {
1444
1439
  const examplesPath = resolve(dotEnvPath, "examples");
1445
- const examplesEnvSpecificPath = resolve(examplesPath, envSpecificFile);
1446
- if (existsSync(examplesEnvSpecificPath)) {
1447
- dotEnvPathFile = examplesEnvSpecificPath;
1448
- }
1449
- }
1450
- if (!dotEnvPathFile) {
1451
- dotEnvPathFile = resolve(dotEnvPath, dotEnvFile);
1452
- if (!existsSync(dotEnvPathFile)) {
1453
- if (!this.get("dotEnvPath")) {
1454
- const examplesPath = resolve(dotEnvPath, "examples");
1455
- const examplesEnvFile = resolve(examplesPath, dotEnvFile);
1456
- if (existsSync(examplesEnvFile)) {
1457
- dotEnvPathFile = examplesEnvFile;
1458
- } else {
1459
- dotEnvPathFile = resolve(dotEnvPath, "..", dotEnvFile);
1460
- }
1461
- }
1440
+ const examplesEnvFile = resolve(examplesPath, dotEnvFile);
1441
+ if (existsSync(examplesEnvFile)) {
1442
+ dotEnvPathFile = examplesEnvFile;
1443
+ } else {
1444
+ dotEnvPathFile = resolve(dotEnvPath, "..", dotEnvFile);
1462
1445
  }
1463
1446
  }
1464
1447
  if (dotEnvPathFile && existsSync(dotEnvPathFile)) {
1465
1448
  config({ path: dotEnvPathFile, quiet: true });
1466
1449
  }
1450
+ const envSpecificFile = `.env.${this.env}`;
1451
+ const envSpecificPath = resolve(dotEnvPath, envSpecificFile);
1452
+ if (existsSync(envSpecificPath) && envSpecificPath !== dotEnvPathFile) {
1453
+ config({ path: envSpecificPath, quiet: true });
1454
+ } else if (!this.get("dotEnvPath")) {
1455
+ const examplesOverlay = resolve(dotEnvPath, "examples", envSpecificFile);
1456
+ if (existsSync(examplesOverlay)) {
1457
+ config({ path: examplesOverlay, quiet: true });
1458
+ }
1459
+ }
1467
1460
  }
1468
1461
  /**
1469
1462
  * Load configuration files
@@ -2683,6 +2676,9 @@ async function init(flow, opts = {}) {
2683
2676
  if (context) {
2684
2677
  await runRegisteredCleanups(context);
2685
2678
  }
2679
+ if (process.exitCode && process.exitCode !== 0) {
2680
+ process.exit(process.exitCode);
2681
+ }
2686
2682
  }
2687
2683
  }
2688
2684
  function setupContext(opts = {}) {