@reliverse/dler 1.7.79 → 1.7.81

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.
@@ -10,32 +10,26 @@ declare const _default: import("@reliverse/rempts").Command<{
10
10
  "dev-only": {
11
11
  type: "boolean";
12
12
  description: string;
13
- default: false;
14
13
  };
15
14
  "prod-only": {
16
15
  type: "boolean";
17
16
  description: string;
18
- default: false;
19
17
  };
20
18
  "peer-only": {
21
19
  type: "boolean";
22
20
  description: string;
23
- default: false;
24
21
  };
25
22
  "optional-only": {
26
23
  type: "boolean";
27
24
  description: string;
28
- default: false;
29
25
  };
30
26
  "catalogs-only": {
31
27
  type: "boolean";
32
28
  description: string;
33
- default: false;
34
29
  };
35
30
  "dry-run": {
36
31
  type: "boolean";
37
32
  description: string;
38
- default: false;
39
33
  };
40
34
  concurrency: {
41
35
  type: "number";
@@ -45,7 +39,6 @@ declare const _default: import("@reliverse/rempts").Command<{
45
39
  "with-check-script": {
46
40
  type: "boolean";
47
41
  description: string;
48
- default: false;
49
42
  };
50
43
  linker: {
51
44
  type: "string";
@@ -53,22 +46,19 @@ declare const _default: import("@reliverse/rempts").Command<{
53
46
  allowed: string[];
54
47
  default: string;
55
48
  };
56
- "no-install": {
49
+ "with-install": {
57
50
  type: "boolean";
58
51
  description: string;
59
- default: false;
60
52
  alias: string;
61
53
  };
62
54
  global: {
63
55
  type: "boolean";
64
56
  description: string;
65
- default: false;
66
57
  alias: string;
67
58
  };
68
59
  interactive: {
69
60
  type: "boolean";
70
61
  description: string;
71
- default: false;
72
62
  };
73
63
  filter: {
74
64
  type: "array";
@@ -77,7 +67,6 @@ declare const _default: import("@reliverse/rempts").Command<{
77
67
  "update-catalogs": {
78
68
  type: "boolean";
79
69
  description: string;
80
- default: false;
81
70
  };
82
71
  }>;
83
72
  export default _default;
@@ -348,33 +348,27 @@ export default defineCommand({
348
348
  },
349
349
  "dev-only": {
350
350
  type: "boolean",
351
- description: "Update only devDependencies",
352
- default: false
351
+ description: "Update only devDependencies"
353
352
  },
354
353
  "prod-only": {
355
354
  type: "boolean",
356
- description: "Update only dependencies (production)",
357
- default: false
355
+ description: "Update only dependencies (production)"
358
356
  },
359
357
  "peer-only": {
360
358
  type: "boolean",
361
- description: "Update only peerDependencies",
362
- default: false
359
+ description: "Update only peerDependencies"
363
360
  },
364
361
  "optional-only": {
365
362
  type: "boolean",
366
- description: "Update only optionalDependencies",
367
- default: false
363
+ description: "Update only optionalDependencies"
368
364
  },
369
365
  "catalogs-only": {
370
366
  type: "boolean",
371
- description: "Update only catalog dependencies",
372
- default: false
367
+ description: "Update only catalog dependencies"
373
368
  },
374
369
  "dry-run": {
375
370
  type: "boolean",
376
- description: "Show what would be updated without making changes",
377
- default: false
371
+ description: "Show what would be updated without making changes"
378
372
  },
379
373
  concurrency: {
380
374
  type: "number",
@@ -383,8 +377,7 @@ export default defineCommand({
383
377
  },
384
378
  "with-check-script": {
385
379
  type: "boolean",
386
- description: "Run `bun check` after updating (exclusive for bun environment at the moment)",
387
- default: false
380
+ description: "Run `bun check` after updating (exclusive for bun environment at the moment)"
388
381
  },
389
382
  linker: {
390
383
  type: "string",
@@ -392,22 +385,19 @@ export default defineCommand({
392
385
  allowed: ["isolated", "hoisted"],
393
386
  default: "hoisted"
394
387
  },
395
- "no-install": {
388
+ "with-install": {
396
389
  type: "boolean",
397
- description: "Skip the install step after updating dependencies",
398
- default: false,
399
- alias: "no-i"
390
+ description: "Run the install step after updating dependencies",
391
+ alias: "with-i"
400
392
  },
401
393
  global: {
402
394
  type: "boolean",
403
395
  description: "Update global packages instead of local dependencies",
404
- default: false,
405
396
  alias: "g"
406
397
  },
407
398
  interactive: {
408
399
  type: "boolean",
409
- description: "Interactively select which dependencies to update",
410
- default: false
400
+ description: "Interactively select which dependencies to update"
411
401
  },
412
402
  filter: {
413
403
  type: "array",
@@ -415,8 +405,7 @@ export default defineCommand({
415
405
  },
416
406
  "update-catalogs": {
417
407
  type: "boolean",
418
- description: "Update catalog dependencies to latest versions",
419
- default: false
408
+ description: "Update catalog dependencies to latest versions"
420
409
  }
421
410
  }),
422
411
  async run({ args }) {
@@ -425,15 +414,15 @@ export default defineCommand({
425
414
  return await handleGlobalUpdates(args);
426
415
  }
427
416
  if (args["update-catalogs"]) {
428
- const packageManager = await detectPackageManager(process.cwd());
429
- if (!packageManager) {
417
+ const packageManager2 = await detectPackageManager(process.cwd());
418
+ if (!packageManager2) {
430
419
  relinka("error", "Could not detect package manager");
431
420
  return process.exit(1);
432
421
  }
433
- if (!isCatalogSupported(packageManager)) {
422
+ if (!isCatalogSupported(packageManager2)) {
434
423
  relinka(
435
424
  "error",
436
- `Catalogs are not supported by ${packageManager.name}. Only Bun supports catalogs.`
425
+ `Catalogs are not supported by ${packageManager2.name}. Only Bun supports catalogs.`
437
426
  );
438
427
  return process.exit(1);
439
428
  }
@@ -518,34 +507,48 @@ export default defineCommand({
518
507
  });
519
508
  });
520
509
  } else {
521
- targetDeps = {
522
- ...dependencies,
523
- ...devDependencies,
524
- ...peerDependencies,
525
- ...optionalDependencies
526
- };
510
+ const allDeps = {};
511
+ const allDepSources = {};
527
512
  Object.keys(dependencies).forEach((dep) => {
528
- depSources[dep] = "dependencies";
513
+ const version = dependencies[dep];
514
+ if (version) {
515
+ allDeps[dep] = version;
516
+ allDepSources[dep] = "dependencies";
517
+ }
529
518
  });
530
519
  Object.keys(devDependencies).forEach((dep) => {
531
- depSources[dep] = "devDependencies";
520
+ const version = devDependencies[dep];
521
+ if (version) {
522
+ allDeps[dep] = version;
523
+ allDepSources[dep] = "devDependencies";
524
+ }
532
525
  });
533
526
  Object.keys(peerDependencies).forEach((dep) => {
534
- depSources[dep] = "peerDependencies";
527
+ const version = peerDependencies[dep];
528
+ if (version) {
529
+ allDeps[dep] = version;
530
+ allDepSources[dep] = "peerDependencies";
531
+ }
535
532
  });
536
533
  Object.keys(optionalDependencies).forEach((dep) => {
537
- depSources[dep] = "optionalDependencies";
534
+ const version = optionalDependencies[dep];
535
+ if (version) {
536
+ allDeps[dep] = version;
537
+ allDepSources[dep] = "optionalDependencies";
538
+ }
538
539
  });
539
540
  Object.keys(catalog).forEach((dep) => {
540
- targetDeps[dep] = catalog[dep];
541
- depSources[dep] = "catalog";
541
+ allDeps[dep] = catalog[dep];
542
+ allDepSources[dep] = "catalog";
542
543
  });
543
544
  Object.keys(catalogs).forEach((catalogName) => {
544
545
  Object.keys(catalogs[catalogName]).forEach((dep) => {
545
- targetDeps[dep] = catalogs[catalogName][dep];
546
- depSources[dep] = `catalogs.${catalogName}`;
546
+ allDeps[dep] = catalogs[catalogName][dep];
547
+ allDepSources[dep] = `catalogs.${catalogName}`;
547
548
  });
548
549
  });
550
+ targetDeps = allDeps;
551
+ Object.assign(depSources, allDepSources);
549
552
  }
550
553
  const depsToUpdate = Object.keys(targetDeps);
551
554
  let filteredDeps = [];
@@ -692,21 +695,29 @@ export default defineCommand({
692
695
  for (const update of toUpdate) {
693
696
  const dep = update.package;
694
697
  const newVersion = `^${update.latestVersion}`;
695
- const location = update.location;
696
- if (location === "dependencies" && dependencies[dep]) {
698
+ let updated = false;
699
+ if (dependencies[dep]) {
697
700
  if (!updatedPackageJson.dependencies) updatedPackageJson.dependencies = {};
698
701
  updatedPackageJson.dependencies[dep] = newVersion;
699
- } else if (location === "devDependencies" && devDependencies[dep]) {
702
+ updated = true;
703
+ }
704
+ if (devDependencies[dep]) {
700
705
  if (!updatedPackageJson.devDependencies) updatedPackageJson.devDependencies = {};
701
706
  updatedPackageJson.devDependencies[dep] = newVersion;
702
- } else if (location === "peerDependencies" && peerDependencies[dep]) {
707
+ updated = true;
708
+ }
709
+ if (peerDependencies[dep]) {
703
710
  if (!updatedPackageJson.peerDependencies) updatedPackageJson.peerDependencies = {};
704
711
  updatedPackageJson.peerDependencies[dep] = newVersion;
705
- } else if (location === "optionalDependencies" && optionalDependencies[dep]) {
712
+ updated = true;
713
+ }
714
+ if (optionalDependencies[dep]) {
706
715
  if (!updatedPackageJson.optionalDependencies)
707
716
  updatedPackageJson.optionalDependencies = {};
708
717
  updatedPackageJson.optionalDependencies[dep] = newVersion;
709
- } else if (location === "catalog" && catalog[dep]) {
718
+ updated = true;
719
+ }
720
+ if (catalog[dep]) {
710
721
  if (!updatedPackageJson.workspaces) updatedPackageJson.workspaces = {};
711
722
  if (!updatedPackageJson.workspaces.catalog)
712
723
  updatedPackageJson.workspaces.catalog = {};
@@ -714,9 +725,10 @@ export default defineCommand({
714
725
  if (updatedPackageJson.catalog) {
715
726
  updatedPackageJson.catalog[dep] = newVersion;
716
727
  }
717
- } else if (location?.startsWith("catalogs.")) {
718
- const catalogName = location.split(".")[1];
719
- if (catalogName) {
728
+ updated = true;
729
+ }
730
+ Object.keys(catalogs).forEach((catalogName) => {
731
+ if (catalogs[catalogName][dep]) {
720
732
  if (!updatedPackageJson.workspaces)
721
733
  updatedPackageJson.workspaces = {};
722
734
  if (!updatedPackageJson.workspaces.catalogs)
@@ -728,8 +740,9 @@ export default defineCommand({
728
740
  if (updatedPackageJson.catalogs && updatedPackageJson.catalogs[catalogName]) {
729
741
  updatedPackageJson.catalogs[catalogName][dep] = newVersion;
730
742
  }
743
+ updated = true;
731
744
  }
732
- }
745
+ });
733
746
  }
734
747
  await fs.writeFile(
735
748
  packageJsonPath,
@@ -737,39 +750,36 @@ export default defineCommand({
737
750
  "utf8"
738
751
  );
739
752
  relinka("success", `Updated ${toUpdate.length} dependencies in package.json`);
740
- if (!args["no-install"]) {
741
- const packageManager = await detectPackageManager(process.cwd());
742
- if (packageManager) {
743
- try {
744
- if (args.filter && args.filter.length > 0) {
745
- const filterArgs = args.filter.flatMap((filter) => ["--filter", filter]);
746
- await runInstallCommandWithFilter(packageManager, effectiveLinker, filterArgs);
747
- } else {
748
- await runInstallCommand(packageManager, effectiveLinker);
749
- }
750
- if (packageManager.name === "bun" && packageJson.scripts?.check && args["with-check-script"]) {
751
- await $`bun check`;
752
- }
753
- } catch (error) {
754
- relinka(
755
- "warn",
756
- `Install failed: ${error instanceof Error ? error.message : String(error)}`
757
- );
758
- relinka(
759
- "info",
760
- `Run '${packageManager.command} install' manually to apply the changes`
761
- );
762
- }
763
- } else {
764
- relinka("warn", "Could not detect package manager. Please run install manually.");
765
- }
766
- } else {
767
- const packageManager = await detectPackageManager(process.cwd());
768
- const installCommand = packageManager ? `${packageManager.command} install` : "your package manager's install command";
753
+ if (args["with-install"] !== true) {
754
+ const packageManager2 = await detectPackageManager(process.cwd());
755
+ const installCommand = packageManager2 ? `${packageManager2.command} install` : "your package manager's install command";
769
756
  relinka(
770
757
  "info",
771
- `Skipped install step due to --no-install flag. Run '${installCommand}' to apply the changes.`
758
+ `Skipped install step. Use --with-install flag to run '${installCommand}' after updating.`
772
759
  );
760
+ return;
761
+ }
762
+ const packageManager = await detectPackageManager(process.cwd());
763
+ if (packageManager) {
764
+ try {
765
+ if (args.filter && args.filter.length > 0) {
766
+ const filterArgs = args.filter.flatMap((filter) => ["--filter", filter]);
767
+ await runInstallCommandWithFilter(packageManager, effectiveLinker, filterArgs);
768
+ } else {
769
+ await runInstallCommand(packageManager, effectiveLinker);
770
+ }
771
+ if (packageManager.name === "bun" && packageJson.scripts?.check && args["with-check-script"]) {
772
+ await $`bun check`;
773
+ }
774
+ } catch (error) {
775
+ relinka(
776
+ "warn",
777
+ `Install failed: ${error instanceof Error ? error.message : String(error)}`
778
+ );
779
+ relinka("info", `Run '${packageManager.command} install' manually to apply the changes`);
780
+ }
781
+ } else {
782
+ relinka("warn", "Could not detect package manager. Please run install manually.");
773
783
  }
774
784
  } catch (error) {
775
785
  relinka(
@@ -1,5 +1,5 @@
1
1
  import { endPrompt, startPrompt } from "@reliverse/rempts";
2
- const version = "1.7.79";
2
+ const version = "1.7.81";
3
3
  export async function showStartPrompt(isDev) {
4
4
  await startPrompt({
5
5
  titleColor: "inverse",
package/package.json CHANGED
@@ -52,7 +52,7 @@
52
52
  "license": "MIT",
53
53
  "name": "@reliverse/dler",
54
54
  "type": "module",
55
- "version": "1.7.79",
55
+ "version": "1.7.81",
56
56
  "keywords": [
57
57
  "reliverse",
58
58
  "cli",