@reliverse/dler 2.2.17 → 2.3.1

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.
@@ -3,17 +3,9 @@ import { cpus } from "node:os";
3
3
  import { join, relative, resolve } from "node:path";
4
4
  import { writeErrorLines } from "@reliverse/helpers";
5
5
  import pMap from "@reliverse/mapkit";
6
- import {
7
- createIgnoreFilter,
8
- createIncludeFilter,
9
- normalizePatterns
10
- } from "@reliverse/matcha";
6
+ import { createIgnoreFilter, createIncludeFilter, normalizePatterns } from "@reliverse/matcha";
11
7
  import { logger } from "@reliverse/relinka";
12
- import {
13
- getWorkspacePatterns,
14
- hasWorkspaces,
15
- readPackageJSON
16
- } from "@reliverse/typerso";
8
+ import { getWorkspacePatterns, hasWorkspaces, readPackageJSON } from "@reliverse/typerso";
17
9
  import clipboard from "clipboardy";
18
10
  import { lookpath } from "lookpath";
19
11
  import { TscCache } from "./cache.js";
@@ -31,7 +23,9 @@ const findMonorepoRoot = async (startDir) => {
31
23
  }
32
24
  }
33
25
  const parentDir = resolve(currentDir, "..");
34
- if (parentDir === currentDir) break;
26
+ if (parentDir === currentDir) {
27
+ break;
28
+ }
35
29
  currentDir = parentDir;
36
30
  }
37
31
  return null;
@@ -95,13 +89,17 @@ const getWorkspacePackages = async (cwd) => {
95
89
  const matches = glob.scanSync({ cwd: monorepoRoot, onlyFiles: false });
96
90
  for (const match of matches) {
97
91
  const packagePath = resolve(monorepoRoot, match);
98
- if (seenPaths.has(packagePath)) continue;
92
+ if (seenPaths.has(packagePath)) {
93
+ continue;
94
+ }
99
95
  seenPaths.add(packagePath);
100
96
  allPackagePaths.push(packagePath);
101
97
  }
102
98
  } else {
103
99
  const packagePath = resolve(monorepoRoot, pattern);
104
- if (seenPaths.has(packagePath)) continue;
100
+ if (seenPaths.has(packagePath)) {
101
+ continue;
102
+ }
105
103
  seenPaths.add(packagePath);
106
104
  allPackagePaths.push(packagePath);
107
105
  }
@@ -145,7 +143,9 @@ const filterPackages = (packages, ignore, filter) => {
145
143
  const hasProjectReferences = async (packagePath) => {
146
144
  try {
147
145
  const tsConfigPath = join(packagePath, "tsconfig.json");
148
- if (!existsSync(tsConfigPath)) return false;
146
+ if (!existsSync(tsConfigPath)) {
147
+ return false;
148
+ }
149
149
  const content = await Bun.file(tsConfigPath).text();
150
150
  const config = JSON.parse(content);
151
151
  return !!(config.references && Array.isArray(config.references) && config.references.length > 0);
@@ -165,7 +165,9 @@ const findTscExecutable = async (packagePath) => {
165
165
  return parentLocalTscPath;
166
166
  }
167
167
  const parentDir = resolve(currentDir, "..");
168
- if (parentDir === currentDir) break;
168
+ if (parentDir === currentDir) {
169
+ break;
170
+ }
169
171
  currentDir = parentDir;
170
172
  }
171
173
  const globalTscPath = await lookpath("tsc");
@@ -176,11 +178,7 @@ const findTscExecutable = async (packagePath) => {
176
178
  };
177
179
  const runTscCommand = async (packagePath, options = {}) => {
178
180
  try {
179
- const {
180
- incremental = true,
181
- buildMode = false,
182
- tscExecutable: providedTsc
183
- } = options;
181
+ const { incremental = true, buildMode = false, tscExecutable: providedTsc } = options;
184
182
  const tscExecutable = providedTsc ?? await findTscExecutable(packagePath);
185
183
  if (!tscExecutable) {
186
184
  throw new Error(
@@ -285,12 +283,7 @@ const checkRequiredDependencies = async (packagePath) => {
285
283
  }
286
284
  };
287
285
  const runTscOnPackage = async (pkg, monorepoRoot, options = {}) => {
288
- const {
289
- verbose = false,
290
- cache,
291
- incremental = true,
292
- buildMode = false
293
- } = options;
286
+ const { verbose = false, cache, incremental = true, buildMode = false } = options;
294
287
  const startTime = Date.now();
295
288
  if (!pkg.hasTsConfig) {
296
289
  if (verbose) {
@@ -310,10 +303,8 @@ const runTscOnPackage = async (pkg, monorepoRoot, options = {}) => {
310
303
  executionTime: Date.now() - startTime
311
304
  };
312
305
  }
313
- const { hasTypeScript, hasTypesBun } = await checkRequiredDependencies(
314
- pkg.path
315
- );
316
- if (!hasTypeScript || !hasTypesBun) {
306
+ const { hasTypeScript, hasTypesBun } = await checkRequiredDependencies(pkg.path);
307
+ if (!(hasTypeScript && hasTypesBun)) {
317
308
  const missing = [];
318
309
  if (!hasTypeScript) {
319
310
  missing.push("typescript");
@@ -361,14 +352,8 @@ const runTscOnPackage = async (pkg, monorepoRoot, options = {}) => {
361
352
  const normalizedTscPath = resolve(tscExecutable);
362
353
  const normalizedPackagePath = resolve(pkg.path);
363
354
  const normalizedMonorepoRoot = resolve(monorepoRoot);
364
- const relativeToPackage = relative(
365
- normalizedPackagePath,
366
- normalizedTscPath
367
- );
368
- const relativeToMonorepo = relative(
369
- normalizedMonorepoRoot,
370
- normalizedTscPath
371
- );
355
+ const relativeToPackage = relative(normalizedPackagePath, normalizedTscPath);
356
+ const relativeToMonorepo = relative(normalizedMonorepoRoot, normalizedTscPath);
372
357
  let source;
373
358
  if (normalizedTscPath.startsWith(normalizedPackagePath)) {
374
359
  source = `local (${relativeToPackage})`;
@@ -421,9 +406,7 @@ const runTscOnPackage = async (pkg, monorepoRoot, options = {}) => {
421
406
  const errorMessage = error instanceof Error ? error.message : String(error);
422
407
  if (errorMessage.includes("TypeScript not found") || errorMessage.includes("Executable not found")) {
423
408
  if (verbose) {
424
- logger.info(
425
- `\u23ED\uFE0F Skipping ${pkg.name} (TypeScript not installed in this package)`
426
- );
409
+ logger.info(`\u23ED\uFE0F Skipping ${pkg.name} (TypeScript not installed in this package)`);
427
410
  }
428
411
  return {
429
412
  package: pkg,
@@ -471,15 +454,13 @@ const collectAllResults = async (packages, monorepoRoot, options = {}, cache) =>
471
454
  packages,
472
455
  async (pkg, index) => {
473
456
  if (!verbose) {
474
- logger.info(
475
- `Processing ${pkg.name} (${index + 1}/${packages.length})...`
476
- );
457
+ logger.info(`Processing ${pkg.name} (${index + 1}/${packages.length})...`);
477
458
  }
478
459
  return runTscOnPackage(pkg, monorepoRoot, {
479
460
  verbose,
480
- cache,
481
461
  incremental,
482
- buildMode
462
+ buildMode,
463
+ ...cache && { cache }
483
464
  });
484
465
  },
485
466
  {
@@ -487,19 +468,11 @@ const collectAllResults = async (packages, monorepoRoot, options = {}, cache) =>
487
468
  stopOnError
488
469
  }
489
470
  );
490
- const failedPackages = tscResults.filter(
491
- (r) => !r.success && !r.skipped
492
- ).length;
471
+ const failedPackages = tscResults.filter((r) => !(r.success || r.skipped)).length;
493
472
  const successfulPackages = tscResults.filter((r) => r.success).length;
494
473
  const skippedPackages = tscResults.filter((r) => r.skipped).length;
495
- const totalErrors = tscResults.reduce(
496
- (sum, r) => sum + r.filteredErrors,
497
- 0
498
- );
499
- const totalWarnings = tscResults.reduce(
500
- (sum, r) => sum + r.filteredWarnings,
501
- 0
502
- );
474
+ const totalErrors = tscResults.reduce((sum, r) => sum + r.filteredErrors, 0);
475
+ const totalWarnings = tscResults.reduce((sum, r) => sum + r.filteredWarnings, 0);
503
476
  return {
504
477
  totalPackages: packages.length,
505
478
  failedPackages,
@@ -536,19 +509,11 @@ const collectAllResults = async (packages, monorepoRoot, options = {}, cache) =>
536
509
  executionTime: 0
537
510
  };
538
511
  });
539
- const failedPackages = tscResults.filter(
540
- (r) => !r.success && !r.skipped
541
- ).length;
512
+ const failedPackages = tscResults.filter((r) => !(r.success || r.skipped)).length;
542
513
  const successfulPackages = tscResults.filter((r) => r.success).length;
543
514
  const skippedPackages = tscResults.filter((r) => r.skipped).length;
544
- const totalErrors = tscResults.reduce(
545
- (sum, r) => sum + r.filteredErrors,
546
- 0
547
- );
548
- const totalWarnings = tscResults.reduce(
549
- (sum, r) => sum + r.filteredWarnings,
550
- 0
551
- );
515
+ const totalErrors = tscResults.reduce((sum, r) => sum + r.filteredErrors, 0);
516
+ const totalWarnings = tscResults.reduce((sum, r) => sum + r.filteredWarnings, 0);
552
517
  return {
553
518
  totalPackages: packages.length,
554
519
  failedPackages,
@@ -564,7 +529,7 @@ const collectAllResults = async (packages, monorepoRoot, options = {}, cache) =>
564
529
  }
565
530
  };
566
531
  const collectFailedPackageLogs = (summary) => {
567
- const failed = summary.results.filter((r) => !r.success && !r.skipped);
532
+ const failed = summary.results.filter((r) => !(r.success || r.skipped));
568
533
  if (failed.length === 0) {
569
534
  return "";
570
535
  }
@@ -577,9 +542,7 @@ const collectFailedPackageLogs = (summary) => {
577
542
  logs.push("");
578
543
  for (const result of failed) {
579
544
  logs.push(`\u{1F4E6} ${result.package.name}`);
580
- logs.push(
581
- ` Errors: ${result.filteredErrors}, Warnings: ${result.filteredWarnings}`
582
- );
545
+ logs.push(` Errors: ${result.filteredErrors}, Warnings: ${result.filteredWarnings}`);
583
546
  logs.push(` ${"\u2500".repeat(30)}`);
584
547
  if (result.filteredOutput.trim()) {
585
548
  const lines = result.filteredOutput.trim().split("\n").map((line) => ` ${line}`);
@@ -612,7 +575,7 @@ const copyLogsToClipboard = async (summary) => {
612
575
  const formatOutput = (summary, verbose) => {
613
576
  const { totalPackages, failedPackages, successfulPackages, skippedPackages } = summary;
614
577
  logger.log("\u2501".repeat(60));
615
- logger.log(`\u{1F4CA} TypeScript Check Summary:`);
578
+ logger.log("\u{1F4CA} TypeScript Check Summary:");
616
579
  logger.log(` Total packages: ${totalPackages}`);
617
580
  logger.log(` \u2705 Passed: ${successfulPackages}`);
618
581
  logger.log(` \u274C Failed: ${failedPackages}`);
@@ -620,14 +583,12 @@ const formatOutput = (summary, verbose) => {
620
583
  logger.log(` \u{1F41B} Total errors: ${summary.totalErrors}`);
621
584
  logger.log(` \u26A0\uFE0F Total warnings: ${summary.totalWarnings}`);
622
585
  logger.log("\u2501".repeat(60));
623
- const failed = summary.results.filter((r) => !r.success && !r.skipped);
586
+ const failed = summary.results.filter((r) => !(r.success || r.skipped));
624
587
  if (failed.length > 0) {
625
588
  logger.error("\n\u274C Failed Packages:\n");
626
589
  for (const result of failed) {
627
590
  logger.error(`\u{1F4E6} ${result.package.name}`);
628
- logger.error(
629
- ` Errors: ${result.filteredErrors}, Warnings: ${result.filteredWarnings}`
630
- );
591
+ logger.error(` Errors: ${result.filteredErrors}, Warnings: ${result.filteredWarnings}`);
631
592
  if (result.filteredOutput.trim()) {
632
593
  logger.error(" \u2500".repeat(30));
633
594
  const lines = result.filteredOutput.trim().split("\n").map((line) => ` ${line}`);
@@ -669,9 +630,7 @@ export const runTscOnAllPackages = async (ignore, cwd, options = {}) => {
669
630
  const discoveryResult = await getWorkspacePackages(cwd);
670
631
  const { packages: allPackages, discoveryTime } = discoveryResult;
671
632
  if (verbose) {
672
- logger.info(
673
- ` Found ${allPackages.length} packages (${discoveryTime}ms)`
674
- );
633
+ logger.info(` Found ${allPackages.length} packages (${discoveryTime}ms)`);
675
634
  logger.info(" Packages found:");
676
635
  for (const pkg of allPackages) {
677
636
  const configStatus = pkg.hasTsConfig ? "\u2705" : "\u23ED\uFE0F";
@@ -683,16 +642,12 @@ export const runTscOnAllPackages = async (ignore, cwd, options = {}) => {
683
642
  const filteredCount = allPackages.length - packages.length;
684
643
  if (options.filter) {
685
644
  const patterns = normalizePatterns(options.filter);
686
- logger.info(
687
- ` Filtering to ${packages.length} packages matching: ${patterns.join(", ")}`
688
- );
645
+ logger.info(` Filtering to ${packages.length} packages matching: ${patterns.join(", ")}`);
689
646
  } else if (filteredCount > 0) {
690
647
  const alwaysIgnored = ["@reliverse/dler-v1"];
691
648
  const combinedIgnore = ignore ? Array.isArray(ignore) ? [...alwaysIgnored, ...ignore] : [...alwaysIgnored, ignore] : alwaysIgnored;
692
649
  const patterns = normalizePatterns(combinedIgnore);
693
- logger.info(
694
- ` Ignoring ${filteredCount} packages matching: ${patterns.join(", ")}`
695
- );
650
+ logger.info(` Ignoring ${filteredCount} packages matching: ${patterns.join(", ")}`);
696
651
  }
697
652
  let concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
698
653
  if (autoConcurrency) {
@@ -706,12 +661,7 @@ export const runTscOnAllPackages = async (ignore, cwd, options = {}) => {
706
661
  if (verbose) {
707
662
  logger.info("\u{1F680} Starting TypeScript checks...\n");
708
663
  }
709
- const summary = await collectAllResults(
710
- packages,
711
- discoveryResult.monorepoRoot,
712
- options,
713
- cache
714
- );
664
+ const summary = await collectAllResults(packages, discoveryResult.monorepoRoot, options, cache);
715
665
  formatOutput(summary, verbose);
716
666
  if (copyLogs && summary.hasErrors) {
717
667
  await copyLogsToClipboard(summary);
@@ -1,2 +1,12 @@
1
- declare const _default: any;
1
+ declare const _default: import("@reliverse/rempts-core").Command<{
2
+ ci: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
3
+ cwd: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
4
+ name: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
5
+ ignore: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
6
+ dryRun: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
7
+ install: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
8
+ allowMajor: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
9
+ details: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
10
+ ignoreFields: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
11
+ }, {}, string>;
2
12
  export default _default;
@@ -1,8 +1,8 @@
1
- import { getCurrentWorkingDirectory } from "@reliverse/helpers";
2
1
  import path from "@reliverse/pathkit";
3
2
  import { logger } from "@reliverse/relinka";
4
- import { defineArgs, defineCommand } from "@reliverse/rempts";
5
- import { msgs } from "../const.js";
3
+ import { defineCommand, option } from "@reliverse/rempts-core";
4
+ import { type } from "arktype";
5
+ import { msgs } from "../../const.js";
6
6
  import {
7
7
  checkPackageUpdatesForFile,
8
8
  handleInstallation,
@@ -12,77 +12,53 @@ import {
12
12
  } from "./impl.js";
13
13
  import { displayStructuredUpdateResults } from "./utils.js";
14
14
  export default defineCommand({
15
- meta: {
16
- name: "update",
17
- description: "Update all dependencies to their latest versions across all package.json files. Supports selective updates with glob patterns and comprehensive filtering options.",
18
- examples: [
19
- "dler update",
20
- "dler update --no-install",
21
- "dler update --dryRun",
22
- "dler update --name @types/* --name react*",
23
- 'dler update --ignore "eslint-*" --ignore "@babel/*"',
24
- "dler update --no-allowMajor",
25
- "dler update --details",
26
- "dler update --ignoreFields peerDependencies",
27
- "dler update --dryRun --no-install",
28
- "dler update --name react --name react-dom",
29
- "dler update --ignore @types/* --allowMajor"
30
- ]
31
- },
32
- args: defineArgs({
33
- ci: {
34
- type: "boolean",
35
- description: msgs.args.ci,
36
- default: !process.stdout.isTTY || !!process.env.CI
37
- },
38
- cwd: {
39
- type: "string",
40
- description: msgs.args.cwd,
41
- default: getCurrentWorkingDirectory()
42
- },
43
- name: {
44
- type: "string",
15
+ description: "Update all dependencies to their latest versions across all package.json files. Supports selective updates with glob patterns and comprehensive filtering options.",
16
+ options: {
17
+ ci: option(type("boolean | undefined"), {
18
+ description: msgs.args.ci
19
+ }),
20
+ cwd: option(type("string | undefined"), {
21
+ description: msgs.args.cwd
22
+ }),
23
+ name: option(type("string | undefined"), {
45
24
  description: "Specific dependencies to update, supports glob patterns (e.g. '@types/*', 'react*'). Can be specified multiple times or comma-separated."
46
- },
47
- ignore: {
48
- type: "string",
25
+ }),
26
+ ignore: option(type("string | undefined"), {
49
27
  description: "Dependencies to exclude from updates, supports glob patterns (e.g. 'eslint-*', '@types/*')"
50
- },
51
- dryRun: {
52
- type: "boolean",
28
+ }),
29
+ dryRun: option(type("boolean | undefined"), {
53
30
  description: "Preview updates without making changes"
54
- },
55
- install: {
56
- type: "boolean",
31
+ }),
32
+ install: option(type("boolean | undefined"), {
57
33
  description: "Run install after updating (default: true)",
58
- default: true,
59
- aliases: ["i"]
60
- },
61
- allowMajor: {
62
- type: "boolean",
63
- description: "Allow major version updates (default: true)",
64
- default: true
65
- },
66
- details: {
67
- type: "boolean",
34
+ short: "i"
35
+ }),
36
+ allowMajor: option(type("boolean | undefined"), {
37
+ description: "Allow major version updates (default: true)"
38
+ }),
39
+ details: option(type("boolean | undefined"), {
68
40
  description: "Show detailed dependency information (default: false)",
69
- aliases: ["d"]
70
- },
71
- ignoreFields: {
72
- type: "string",
41
+ short: "d"
42
+ }),
43
+ ignoreFields: option(type("string | undefined"), {
73
44
  description: "Dependency fields to ignore (e.g., 'peerDependencies,catalog')"
74
- }
75
- }),
76
- run: async ({ args }) => {
45
+ })
46
+ },
47
+ handler: async ({ flags }) => {
77
48
  try {
78
49
  if (typeof process.versions.bun === "undefined") {
79
50
  logger.error("This command requires Bun runtime. Sorry.");
80
51
  process.exit(1);
81
52
  }
82
- const { dryRun, install, details, ignoreFields } = args;
83
- const isDryRun = Boolean(dryRun);
84
- const showDetails = Boolean(details);
85
- const fieldsToIgnore = Array.isArray(ignoreFields) ? ignoreFields : [];
53
+ const ci = flags.ci ?? (!process.stdout.isTTY || !!process.env.CI);
54
+ const dryRun = flags.dryRun ?? false;
55
+ const install = flags.install ?? true;
56
+ const allowMajor = flags.allowMajor ?? true;
57
+ const details = flags.details ?? false;
58
+ const isDryRun = dryRun;
59
+ const shouldInstall = install;
60
+ const showDetails = details;
61
+ const fieldsToIgnore = flags.ignoreFields ? typeof flags.ignoreFields === "string" ? flags.ignoreFields.split(",").map((s) => s.trim()) : [] : [];
86
62
  await validatePackageJson();
87
63
  const { packageJsonFiles, fileDepsMap } = await prepareAllUpdateCandidates();
88
64
  if (packageJsonFiles.length === 0) {
@@ -93,24 +69,29 @@ export default defineCommand({
93
69
  const allResults = [];
94
70
  for (const packageJsonPath of packageJsonFiles) {
95
71
  const fileDeps = fileDepsMap.get(packageJsonPath);
96
- if (!fileDeps) continue;
72
+ if (!fileDeps) {
73
+ continue;
74
+ }
97
75
  const updateArgs = {
98
- ...args,
99
- name: args.name ? Array.isArray(args.name) ? args.name : [args.name] : void 0,
100
- ignore: args.ignore ? Array.isArray(args.ignore) ? args.ignore : [args.ignore] : void 0,
101
- ignoreFields: args.ignoreFields ? Array.isArray(args.ignoreFields) ? args.ignoreFields : args.ignoreFields.split(",").map((s) => s.trim()) : void 0
76
+ ci,
77
+ ...flags.name && {
78
+ name: typeof flags.name === "string" ? [flags.name] : flags.name
79
+ },
80
+ ...flags.ignore && {
81
+ ignore: typeof flags.ignore === "string" ? [flags.ignore] : flags.ignore
82
+ },
83
+ allowMajor,
84
+ dryRun: isDryRun,
85
+ install: shouldInstall,
86
+ ignoreFields: fieldsToIgnore
102
87
  };
103
88
  const results = await checkPackageUpdatesForFile(fileDeps, updateArgs);
104
89
  allResults.push(...results);
105
- const toUpdate = results.filter(
106
- (r) => r.updated && !r.error
107
- );
90
+ const toUpdate = results.filter((r) => r.updated && !r.error);
108
91
  if (toUpdate.length > 0) {
109
92
  if (isDryRun) {
110
93
  const relativePath = path.relative(process.cwd(), packageJsonPath);
111
- logger.debug(
112
- `Would update ${toUpdate.length} dependencies in ${relativePath}`
113
- );
94
+ logger.debug(`Would update ${toUpdate.length} dependencies in ${relativePath}`);
114
95
  continue;
115
96
  }
116
97
  const updated = await updatePackageJsonFileDirectly(
@@ -127,12 +108,7 @@ export default defineCommand({
127
108
  }
128
109
  }
129
110
  }
130
- displayStructuredUpdateResults(
131
- allResults,
132
- packageJsonFiles,
133
- fileDepsMap,
134
- showDetails
135
- );
111
+ displayStructuredUpdateResults(allResults, packageJsonFiles, fileDepsMap, showDetails);
136
112
  if (totalUpdated === 0) {
137
113
  if (isDryRun) {
138
114
  logger.log("Dry run mode - no changes would be made");
@@ -148,7 +124,7 @@ export default defineCommand({
148
124
  } else {
149
125
  logger.log(`Updated ${totalUpdated} dependencies`);
150
126
  }
151
- if (install) {
127
+ if (shouldInstall) {
152
128
  await handleInstallation();
153
129
  } else {
154
130
  logger.log(
@@ -26,7 +26,7 @@ export async function prepareAllUpdateCandidates() {
26
26
  onlyFiles: true
27
27
  })) {
28
28
  const fullPath = path.resolve(process.cwd(), file);
29
- if (!file.includes("node_modules") && !file.includes("dist") && !file.includes("build") && !file.includes(".git") && !file.includes("coverage") && !file.includes(".next") && !file.includes("out") && !file.includes("target") && !file.includes(".turbo")) {
29
+ if (!(file.includes("node_modules") || file.includes("dist") || file.includes("build") || file.includes(".git") || file.includes("coverage") || file.includes(".next") || file.includes("out") || file.includes("target") || file.includes(".turbo"))) {
30
30
  packageJsonFiles.push(fullPath);
31
31
  }
32
32
  }
@@ -38,9 +38,7 @@ export async function prepareAllUpdateCandidates() {
38
38
  const fileDepsMap = /* @__PURE__ */ new Map();
39
39
  for (const packageJsonPath of packageJsonFiles) {
40
40
  try {
41
- const packageJson = JSON.parse(
42
- await fs.readFile(packageJsonPath, { encoding: "utf8" })
43
- );
41
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: "utf8" }));
44
42
  const { map } = collectTargetDependencies(packageJson);
45
43
  fileDepsMap.set(packageJsonPath, map);
46
44
  } catch (error) {
@@ -78,18 +76,15 @@ export async function checkPackageUpdatesForFile(fileDepsMap, args) {
78
76
  location: "unknown"
79
77
  };
80
78
  }
81
- return checkPackageUpdate(
82
- dep,
83
- depInfo.versionSpec,
84
- depInfo.locations,
85
- options
86
- );
79
+ return checkPackageUpdate(dep, depInfo.versionSpec, depInfo.locations, options);
87
80
  },
88
81
  { concurrency: args.concurrency || 5 }
89
82
  );
90
83
  }
91
84
  export async function updatePackageJsonFileDirectly(packageJsonPath, fileDepsMap, updatesToApply, savePrefix, fieldsToIgnore = []) {
92
- if (updatesToApply.length === 0) return 0;
85
+ if (updatesToApply.length === 0) {
86
+ return 0;
87
+ }
93
88
  try {
94
89
  const packageJson = JSON.parse(
95
90
  await fs.readFile(packageJsonPath, { encoding: "utf8" })
@@ -97,7 +92,9 @@ export async function updatePackageJsonFileDirectly(packageJsonPath, fileDepsMap
97
92
  const updatedPackageJson = { ...packageJson };
98
93
  for (const update of updatesToApply) {
99
94
  const depInfo = fileDepsMap[update.package];
100
- if (!depInfo) continue;
95
+ if (!depInfo) {
96
+ continue;
97
+ }
101
98
  const locations = depInfo.locations || /* @__PURE__ */ new Set();
102
99
  const shouldIgnore = Array.from(locations).some(
103
100
  (location) => fieldsToIgnore.includes(String(location))
@@ -107,9 +104,7 @@ export async function updatePackageJsonFileDirectly(packageJsonPath, fileDepsMap
107
104
  }
108
105
  let newVersion;
109
106
  if (locations.has("peerDependencies")) {
110
- const currentVersion = String(
111
- fileDepsMap[update.package]?.versionSpec || ""
112
- );
107
+ const currentVersion = String(fileDepsMap[update.package]?.versionSpec || "");
113
108
  if (currentVersion.startsWith(">=")) {
114
109
  newVersion = `>=${update.latestVersion}`;
115
110
  } else {
@@ -118,19 +113,12 @@ export async function updatePackageJsonFileDirectly(packageJsonPath, fileDepsMap
118
113
  } else {
119
114
  newVersion = savePrefix === "none" ? update.latestVersion : `${savePrefix}${update.latestVersion}`;
120
115
  }
121
- applyVersionUpdate(
122
- updatedPackageJson,
123
- update.package,
124
- newVersion,
125
- locations
126
- );
116
+ applyVersionUpdate(updatedPackageJson, update.package, newVersion, locations);
127
117
  }
128
- await fs.writeFile(
129
- packageJsonPath,
130
- `${JSON.stringify(updatedPackageJson, null, 2)}
131
- `,
132
- { encoding: "utf8" }
133
- );
118
+ await fs.writeFile(packageJsonPath, `${JSON.stringify(updatedPackageJson, null, 2)}
119
+ `, {
120
+ encoding: "utf8"
121
+ });
134
122
  return updatesToApply.length;
135
123
  } catch (error) {
136
124
  logger.warn(
@@ -144,9 +132,7 @@ export async function handleInstallation() {
144
132
  await runInstallCommand();
145
133
  logger.log("Installation completed successfully");
146
134
  } catch (error) {
147
- logger.warn(
148
- `Install failed: ${error instanceof Error ? error.message : String(error)}`
149
- );
135
+ logger.warn(`Install failed: ${error instanceof Error ? error.message : String(error)}`);
150
136
  logger.log("Run 'bun install' manually to apply the changes");
151
137
  }
152
138
  }