pruny 1.29.0 → 1.31.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 +56 -37
- 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
|
}
|
|
@@ -16472,6 +16475,17 @@ function printDetailedReport(result) {
|
|
|
16472
16475
|
}
|
|
16473
16476
|
console.log("");
|
|
16474
16477
|
}
|
|
16478
|
+
if (result.missingAssets && result.missingAssets.total > 0) {
|
|
16479
|
+
console.log(source_default.yellow.bold(`⚠️ Missing Assets (Broken Links):
|
|
16480
|
+
`));
|
|
16481
|
+
for (const asset of result.missingAssets.assets) {
|
|
16482
|
+
console.log(source_default.red(` ${asset.path}`));
|
|
16483
|
+
for (const ref of asset.references) {
|
|
16484
|
+
console.log(source_default.dim(` → Referenced in: ${ref}`));
|
|
16485
|
+
}
|
|
16486
|
+
}
|
|
16487
|
+
console.log("");
|
|
16488
|
+
}
|
|
16475
16489
|
if (result.unusedServices && result.unusedServices.methods.length > 0) {
|
|
16476
16490
|
console.log(source_default.red.bold(`\uD83D\uDEE0️ Unused Service Methods:
|
|
16477
16491
|
`));
|
|
@@ -16493,10 +16507,11 @@ function countIssues(result) {
|
|
|
16493
16507
|
const unusedRoutes = result.routes.filter((r) => !r.used).length;
|
|
16494
16508
|
const partialRoutes = result.routes.filter((r) => r.used && r.unusedMethods.length > 0).length;
|
|
16495
16509
|
const unusedAssets = result.publicAssets ? result.publicAssets.unused : 0;
|
|
16510
|
+
const missingAssets = result.missingAssets ? result.missingAssets.total : 0;
|
|
16496
16511
|
const unusedFiles = result.unusedFiles ? result.unusedFiles.unused : 0;
|
|
16497
16512
|
const unusedExports = result.unusedExports ? result.unusedExports.unused : 0;
|
|
16498
16513
|
const unusedServices = result.unusedServices ? result.unusedServices.total : 0;
|
|
16499
|
-
return unusedRoutes + partialRoutes + unusedAssets + unusedFiles + unusedExports + unusedServices;
|
|
16514
|
+
return unusedRoutes + partialRoutes + unusedAssets + missingAssets + unusedFiles + unusedExports + unusedServices;
|
|
16500
16515
|
}
|
|
16501
16516
|
async function handleFixes(result, config, options, showBack) {
|
|
16502
16517
|
const gitRoot = findGitRoot(config.dir);
|
|
@@ -17064,12 +17079,14 @@ function printSummaryTable(result, context) {
|
|
|
17064
17079
|
}
|
|
17065
17080
|
if (summary.length === 0)
|
|
17066
17081
|
summary.push({ Category: "API Routes", Total: result.total, Used: result.used, Unused: result.unused });
|
|
17067
|
-
|
|
17082
|
+
const hasNestRoutes = result.routes.some((r) => r.type === "nestjs");
|
|
17083
|
+
const hasNextRoutes = result.routes.some((r) => r.type === "nextjs");
|
|
17084
|
+
if (result.publicAssets && (hasNextRoutes || result.publicAssets.total > 0)) {
|
|
17068
17085
|
summary.push({ Category: "Public Files (public/)", Total: result.publicAssets.total, Used: result.publicAssets.used, Unused: result.publicAssets.unused });
|
|
17069
|
-
|
|
17070
|
-
|
|
17086
|
+
}
|
|
17087
|
+
if (result.missingAssets && result.missingAssets.total > 0) {
|
|
17071
17088
|
summary.push({
|
|
17072
|
-
Category:
|
|
17089
|
+
Category: source_default.red.bold("⚠ Missing Assets"),
|
|
17073
17090
|
Total: result.missingAssets.total,
|
|
17074
17091
|
Used: "-",
|
|
17075
17092
|
Unused: result.missingAssets.total
|
|
@@ -17079,35 +17096,37 @@ function printSummaryTable(result, context) {
|
|
|
17079
17096
|
summary.push({ Category: "Code Files (.ts/.js)", Total: result.unusedFiles.used + result.unusedFiles.unused, Used: result.unusedFiles.used, Unused: result.unusedFiles.unused });
|
|
17080
17097
|
if (result.unusedExports)
|
|
17081
17098
|
summary.push({ Category: "Named Exports", Total: result.unusedExports.used + result.unusedExports.unused, Used: result.unusedExports.used, Unused: result.unusedExports.unused });
|
|
17082
|
-
if (result.unusedServices)
|
|
17099
|
+
if (result.unusedServices && hasNestRoutes) {
|
|
17083
17100
|
summary.push({ Category: "NestJS Services", Total: result.unusedServices.total, Used: "-", Unused: result.unusedServices.total });
|
|
17101
|
+
}
|
|
17084
17102
|
if (result.httpUsage) {
|
|
17085
|
-
|
|
17086
|
-
Category: "Axios Calls",
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
Unused: "-"
|
|
17090
|
-
}
|
|
17091
|
-
|
|
17092
|
-
Category: "
|
|
17093
|
-
|
|
17094
|
-
|
|
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
|
-
});
|
|
17103
|
+
if (result.httpUsage.axios > 0) {
|
|
17104
|
+
summary.push({ Category: "Axios Calls", Total: result.httpUsage.axios, Used: result.httpUsage.axios, Unused: "-" });
|
|
17105
|
+
}
|
|
17106
|
+
if (result.httpUsage.fetch > 0) {
|
|
17107
|
+
summary.push({ Category: "Fetch Calls", Total: result.httpUsage.fetch, Used: result.httpUsage.fetch, Unused: "-" });
|
|
17108
|
+
}
|
|
17109
|
+
if (result.httpUsage.got > 0) {
|
|
17110
|
+
summary.push({ Category: "Got Calls", Total: result.httpUsage.got, Used: result.httpUsage.got, Unused: "-" });
|
|
17111
|
+
}
|
|
17112
|
+
if (result.httpUsage.ky > 0) {
|
|
17113
|
+
summary.push({ Category: "Ky Calls", Total: result.httpUsage.ky, Used: result.httpUsage.ky, Unused: "-" });
|
|
17114
|
+
}
|
|
17109
17115
|
}
|
|
17110
17116
|
printTable(summary);
|
|
17117
|
+
if (result.missingAssets && result.missingAssets.total > 0) {
|
|
17118
|
+
console.log(source_default.yellow.bold(`
|
|
17119
|
+
⚠ Missing Assets (Broken Links):
|
|
17120
|
+
`));
|
|
17121
|
+
for (const asset of result.missingAssets.assets) {
|
|
17122
|
+
console.log(source_default.red(` ✗ ${asset.path}`));
|
|
17123
|
+
for (const ref of asset.references) {
|
|
17124
|
+
console.log(source_default.dim(` → Referenced in: ${ref}`));
|
|
17125
|
+
}
|
|
17126
|
+
}
|
|
17127
|
+
console.log(source_default.yellow(`
|
|
17128
|
+
These files are referenced in code but don't exist. Update the links or create the files.`));
|
|
17129
|
+
}
|
|
17111
17130
|
}
|
|
17112
17131
|
function printConsolidatedTable(allResults) {
|
|
17113
17132
|
console.log(source_default.bold(`\uD83D\uDCCA Monorepo Summary
|