@nmakarov/cli-toolkit 0.44.0 → 0.47.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.cjs CHANGED
@@ -1459,36 +1459,29 @@ var Args = class _Args {
1459
1459
  }
1460
1460
  return;
1461
1461
  }
1462
- let dotEnvPathFile = null;
1463
- const envSpecificFile = `.env.${this.env}`;
1464
- const envSpecificPath = (0, import_path.resolve)(dotEnvPath, envSpecificFile);
1465
- if ((0, import_fs.existsSync)(envSpecificPath)) {
1466
- dotEnvPathFile = envSpecificPath;
1467
- }
1468
- if (!dotEnvPathFile && !this.get("dotEnvPath")) {
1462
+ let dotEnvPathFile = (0, import_path.resolve)(dotEnvPath, dotEnvFile);
1463
+ if (!(0, import_fs.existsSync)(dotEnvPathFile) && !this.get("dotEnvPath")) {
1469
1464
  const examplesPath = (0, import_path.resolve)(dotEnvPath, "examples");
1470
- const examplesEnvSpecificPath = (0, import_path.resolve)(examplesPath, envSpecificFile);
1471
- if ((0, import_fs.existsSync)(examplesEnvSpecificPath)) {
1472
- dotEnvPathFile = examplesEnvSpecificPath;
1473
- }
1474
- }
1475
- if (!dotEnvPathFile) {
1476
- dotEnvPathFile = (0, import_path.resolve)(dotEnvPath, dotEnvFile);
1477
- if (!(0, import_fs.existsSync)(dotEnvPathFile)) {
1478
- if (!this.get("dotEnvPath")) {
1479
- const examplesPath = (0, import_path.resolve)(dotEnvPath, "examples");
1480
- const examplesEnvFile = (0, import_path.resolve)(examplesPath, dotEnvFile);
1481
- if ((0, import_fs.existsSync)(examplesEnvFile)) {
1482
- dotEnvPathFile = examplesEnvFile;
1483
- } else {
1484
- dotEnvPathFile = (0, import_path.resolve)(dotEnvPath, "..", dotEnvFile);
1485
- }
1486
- }
1465
+ const examplesEnvFile = (0, import_path.resolve)(examplesPath, dotEnvFile);
1466
+ if ((0, import_fs.existsSync)(examplesEnvFile)) {
1467
+ dotEnvPathFile = examplesEnvFile;
1468
+ } else {
1469
+ dotEnvPathFile = (0, import_path.resolve)(dotEnvPath, "..", dotEnvFile);
1487
1470
  }
1488
1471
  }
1489
1472
  if (dotEnvPathFile && (0, import_fs.existsSync)(dotEnvPathFile)) {
1490
1473
  (0, import_dotenv.config)({ path: dotEnvPathFile, quiet: true });
1491
1474
  }
1475
+ const envSpecificFile = `.env.${this.env}`;
1476
+ const envSpecificPath = (0, import_path.resolve)(dotEnvPath, envSpecificFile);
1477
+ if ((0, import_fs.existsSync)(envSpecificPath) && envSpecificPath !== dotEnvPathFile) {
1478
+ (0, import_dotenv.config)({ path: envSpecificPath, quiet: true });
1479
+ } else if (!this.get("dotEnvPath")) {
1480
+ const examplesOverlay = (0, import_path.resolve)(dotEnvPath, "examples", envSpecificFile);
1481
+ if ((0, import_fs.existsSync)(examplesOverlay)) {
1482
+ (0, import_dotenv.config)({ path: examplesOverlay, quiet: true });
1483
+ }
1484
+ }
1492
1485
  }
1493
1486
  /**
1494
1487
  * Load configuration files