@reliverse/rempts 1.7.20 → 1.7.22

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.
@@ -676,21 +676,17 @@ async function runCommandWithArgs(command, argv, parserOptions, returnCtx) {
676
676
  else throw new Error(`Missing required argument: --${key}`);
677
677
  }
678
678
  if (def.dependencies && Array.isArray(def.dependencies)) {
679
- const missingDeps = def.dependencies.filter(
680
- (dependency) => !(parsed[dependency] ?? defaultMap[dependency])
681
- );
682
- if (missingDeps.length > 0) {
683
- const depsList = missingDeps.map((d) => `--${d}`).join(", ");
684
- await showUsage(command, parserOptions);
685
- relinka(
686
- "error",
687
- `Argument --${key} can only be used when ${depsList} ${missingDeps.length === 1 ? "is" : "are"} set`
679
+ const isArgUsed = rawVal !== void 0 || def.default !== void 0;
680
+ if (isArgUsed) {
681
+ const missingDeps = def.dependencies.filter(
682
+ (dependency) => !(parsed[dependency] ?? defaultMap[dependency])
688
683
  );
689
- if (autoExit) process.exit(1);
690
- else
684
+ if (missingDeps.length > 0) {
685
+ const depsList = missingDeps.map((d) => `--${d}`).join(", ");
691
686
  throw new Error(
692
687
  `Argument --${key} can only be used when ${depsList} ${missingDeps.length === 1 ? "is" : "are"} set`
693
688
  );
689
+ }
694
690
  }
695
691
  }
696
692
  try {
@@ -898,14 +894,17 @@ export async function runCmd(command, argv = [], parserOptions = {}) {
898
894
  throw new Error(`Missing required argument: --${key}`);
899
895
  }
900
896
  if (def.dependencies && Array.isArray(def.dependencies)) {
901
- const missingDeps = def.dependencies.filter(
902
- (dependency) => !(parsed[dependency] ?? defaultMap[dependency])
903
- );
904
- if (missingDeps.length > 0) {
905
- const depsList = missingDeps.map((d) => `--${d}`).join(", ");
906
- throw new Error(
907
- `Argument --${key} can only be used when ${depsList} ${missingDeps.length === 1 ? "is" : "are"} set`
897
+ const isArgUsed = rawVal !== void 0 || def.default !== void 0;
898
+ if (isArgUsed) {
899
+ const missingDeps = def.dependencies.filter(
900
+ (dependency) => !(parsed[dependency] ?? defaultMap[dependency])
908
901
  );
902
+ if (missingDeps.length > 0) {
903
+ const depsList = missingDeps.map((d) => `--${d}`).join(", ");
904
+ throw new Error(
905
+ `Argument --${key} can only be used when ${depsList} ${missingDeps.length === 1 ? "is" : "are"} set`
906
+ );
907
+ }
909
908
  }
910
909
  }
911
910
  try {
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "license": "MIT",
30
30
  "name": "@reliverse/rempts",
31
31
  "type": "module",
32
- "version": "1.7.20",
32
+ "version": "1.7.22",
33
33
  "author": "reliverse",
34
34
  "bugs": {
35
35
  "email": "blefnk@gmail.com",