@nmakarov/cli-toolkit 0.9.0 → 0.11.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/index.js CHANGED
@@ -1253,8 +1253,9 @@ var Args = class _Args {
1253
1253
  const resolvedKey = this.aliases[key] || key;
1254
1254
  const lcKey = resolvedKey.toLowerCase();
1255
1255
  this.usedKeys.add(lcKey);
1256
- if (this.overrides[resolvedKey] !== void 0) {
1257
- return this.overrides[resolvedKey];
1256
+ const overrideKey = Object.keys(this.overrides).find((k) => k.toLowerCase() === lcKey);
1257
+ if (overrideKey !== void 0) {
1258
+ return this.overrides[overrideKey];
1258
1259
  }
1259
1260
  const lcKeyWithEnv = `${lcKey}${this.env ? `_${this.env.toLowerCase()}` : ""}`;
1260
1261
  if (this.env && this.args[lcKeyWithEnv] !== void 0) {
@@ -1262,8 +1263,9 @@ var Args = class _Args {
1262
1263
  } else if (this.args[lcKey] !== void 0) {
1263
1264
  return this.args[lcKey];
1264
1265
  }
1265
- if (this.configValues[resolvedKey] !== void 0) {
1266
- return this.configValues[resolvedKey];
1266
+ const configKey = Object.keys(this.configValues).find((k) => k.toLowerCase() === lcKey);
1267
+ if (configKey !== void 0) {
1268
+ return this.configValues[configKey];
1267
1269
  }
1268
1270
  const envKey = this.toEnvKey(resolvedKey);
1269
1271
  const envKeyWithEnv = `${envKey}${this.env ? `_${this.env.toUpperCase()}` : ""}`;
@@ -1271,15 +1273,20 @@ var Args = class _Args {
1271
1273
  (k) => this.env && k.toUpperCase() === envKeyWithEnv
1272
1274
  );
1273
1275
  const envKeyFound = Object.keys(process.env).find((k) => k.toUpperCase() === envKey);
1276
+ const envKeyAlt = envKey.replace(/_([0-9])/g, "$1");
1277
+ const envKeyAltFound = !envKeyFound ? Object.keys(process.env).find((k) => k.toUpperCase() === envKeyAlt) : null;
1274
1278
  if (envSpecificKey) {
1275
1279
  return process.env[envSpecificKey];
1276
1280
  } else if (envKeyFound) {
1277
1281
  return process.env[envKeyFound];
1282
+ } else if (envKeyAltFound) {
1283
+ return process.env[envKeyAltFound];
1278
1284
  }
1279
- if (this.defaults[resolvedKey] !== void 0) {
1280
- return this.defaults[resolvedKey];
1285
+ const defaultKey = Object.keys(this.defaults).find((k) => k.toLowerCase() === lcKey);
1286
+ if (defaultKey !== void 0) {
1287
+ return this.defaults[defaultKey];
1281
1288
  }
1282
- if (resolvedKey === "env" && process.env.NODE_ENV !== void 0) {
1289
+ if (lcKey === "env" && process.env.NODE_ENV !== void 0) {
1283
1290
  return process.env.NODE_ENV;
1284
1291
  }
1285
1292
  return void 0;
@@ -1322,8 +1329,12 @@ var Args = class _Args {
1322
1329
  }
1323
1330
  /**
1324
1331
  * Convert key to environment variable format
1332
+ * Converts camelCase to SNAKE_CASE
1325
1333
  */
1326
1334
  toEnvKey(key) {
1335
+ if (key.includes("_") && key === key.toUpperCase()) {
1336
+ return key;
1337
+ }
1327
1338
  return key.replace(
1328
1339
  /[A-Z0-9]/g,
1329
1340
  (match, offset) => offset === 0 ? match : "_" + match.toLowerCase()
@@ -3218,7 +3229,7 @@ var Logger = class _Logger {
3218
3229
  route: this.shouldUseIpcRoute() ? "ipc" : "console",
3219
3230
  prefix: void 0,
3220
3231
  silent: false,
3221
- showLevel: true,
3232
+ showLevel: false,
3222
3233
  timestamp: false,
3223
3234
  levels: ALL_LEVELS,
3224
3235
  progressTimes: false,