pruny 1.29.0 → 1.30.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.
Files changed (2) hide show
  1. package/dist/index.js +30 -36
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16343,19 +16343,22 @@ program2.action(async (options) => {
16343
16343
  }
16344
16344
  allAppResults.push({ appName, result });
16345
16345
  } else {
16346
- if (options.verbose) {
16347
- printDetailedReport(result);
16348
- }
16349
- if (!options.all) {
16350
- console.log(source_default.dim(`\uD83D\uDCA1 Run with --fix to clean up.
16351
- `));
16352
- }
16353
16346
  printSummaryTable(result, appLabel);
16354
16347
  if (options.all) {
16355
16348
  const issues = countIssues(result);
16356
16349
  if (issues > 0) {
16357
16350
  process.exit(1);
16358
16351
  }
16352
+ } else if (hasUnusedItems(result)) {
16353
+ if (options.verbose) {
16354
+ printDetailedReport(result);
16355
+ }
16356
+ const fixResult = await handleFixes(result, currentConfig, options, false);
16357
+ if (fixResult === "exit" || fixResult === "done") {
16358
+ printSummaryTable(result, appLabel);
16359
+ }
16360
+ } else if (options.verbose) {
16361
+ printDetailedReport(result);
16359
16362
  }
16360
16363
  }
16361
16364
  }
@@ -17064,12 +17067,14 @@ function printSummaryTable(result, context) {
17064
17067
  }
17065
17068
  if (summary.length === 0)
17066
17069
  summary.push({ Category: "API Routes", Total: result.total, Used: result.used, Unused: result.unused });
17067
- if (result.publicAssets)
17070
+ const hasNestRoutes = result.routes.some((r) => r.type === "nestjs");
17071
+ const hasNextRoutes = result.routes.some((r) => r.type === "nextjs");
17072
+ if (result.publicAssets && (hasNextRoutes || result.publicAssets.total > 0)) {
17068
17073
  summary.push({ Category: "Public Files (public/)", Total: result.publicAssets.total, Used: result.publicAssets.used, Unused: result.publicAssets.unused });
17069
- if (result.missingAssets) {
17070
- const isMissing = result.missingAssets.total > 0;
17074
+ }
17075
+ if (result.missingAssets && result.missingAssets.total > 0) {
17071
17076
  summary.push({
17072
- Category: isMissing ? source_default.red.bold("⚠ Missing Assets") : "Missing Assets",
17077
+ Category: source_default.red.bold("⚠ Missing Assets"),
17073
17078
  Total: result.missingAssets.total,
17074
17079
  Used: "-",
17075
17080
  Unused: result.missingAssets.total
@@ -17079,33 +17084,22 @@ function printSummaryTable(result, context) {
17079
17084
  summary.push({ Category: "Code Files (.ts/.js)", Total: result.unusedFiles.used + result.unusedFiles.unused, Used: result.unusedFiles.used, Unused: result.unusedFiles.unused });
17080
17085
  if (result.unusedExports)
17081
17086
  summary.push({ Category: "Named Exports", Total: result.unusedExports.used + result.unusedExports.unused, Used: result.unusedExports.used, Unused: result.unusedExports.unused });
17082
- if (result.unusedServices)
17087
+ if (result.unusedServices && hasNestRoutes) {
17083
17088
  summary.push({ Category: "NestJS Services", Total: result.unusedServices.total, Used: "-", Unused: result.unusedServices.total });
17089
+ }
17084
17090
  if (result.httpUsage) {
17085
- summary.push({
17086
- Category: "Axios Calls",
17087
- Total: result.httpUsage.axios,
17088
- Used: result.httpUsage.axios,
17089
- Unused: "-"
17090
- });
17091
- summary.push({
17092
- Category: "Fetch Calls",
17093
- Total: result.httpUsage.fetch,
17094
- Used: result.httpUsage.fetch,
17095
- Unused: "-"
17096
- });
17097
- summary.push({
17098
- Category: "Got Calls",
17099
- Total: result.httpUsage.got,
17100
- Used: result.httpUsage.got,
17101
- Unused: "-"
17102
- });
17103
- summary.push({
17104
- Category: "Ky Calls",
17105
- Total: result.httpUsage.ky,
17106
- Used: result.httpUsage.ky,
17107
- Unused: "-"
17108
- });
17091
+ if (result.httpUsage.axios > 0) {
17092
+ summary.push({ Category: "Axios Calls", Total: result.httpUsage.axios, Used: result.httpUsage.axios, Unused: "-" });
17093
+ }
17094
+ if (result.httpUsage.fetch > 0) {
17095
+ summary.push({ Category: "Fetch Calls", Total: result.httpUsage.fetch, Used: result.httpUsage.fetch, Unused: "-" });
17096
+ }
17097
+ if (result.httpUsage.got > 0) {
17098
+ summary.push({ Category: "Got Calls", Total: result.httpUsage.got, Used: result.httpUsage.got, Unused: "-" });
17099
+ }
17100
+ if (result.httpUsage.ky > 0) {
17101
+ summary.push({ Category: "Ky Calls", Total: result.httpUsage.ky, Used: result.httpUsage.ky, Unused: "-" });
17102
+ }
17109
17103
  }
17110
17104
  printTable(summary);
17111
17105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruny",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
4
4
  "description": "Find and remove unused Next.js API routes & Nest.js Controllers",
5
5
  "type": "module",
6
6
  "files": [