pruny 1.2.8 → 1.2.9
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/README.md +9 -8
- package/dist/index.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pruny
|
|
2
2
|
|
|
3
|
-
Find and remove unused Next.js API routes. 🪓
|
|
3
|
+
Find and remove unused Next.js API routes & Nest.js Controllers. 🪓
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ pruny
|
|
|
19
19
|
# Scan specific folder
|
|
20
20
|
pruny --dir ./src
|
|
21
21
|
|
|
22
|
-
# Delete unused routes
|
|
22
|
+
# Delete unused routes/controllers
|
|
23
23
|
pruny --fix
|
|
24
24
|
|
|
25
25
|
# Output as JSON
|
|
@@ -50,7 +50,7 @@ Create `pruny.config.json` (optional):
|
|
|
50
50
|
"ignore": {
|
|
51
51
|
"routes": ["/api/webhooks/**", "/api/cron/**"],
|
|
52
52
|
"folders": ["node_modules", ".next", "dist"],
|
|
53
|
-
"files": ["*.test.ts"]
|
|
53
|
+
"files": ["*.test.ts", "*.spec.ts"]
|
|
54
54
|
},
|
|
55
55
|
"extensions": [".ts", ".tsx", ".js", ".jsx"]
|
|
56
56
|
}
|
|
@@ -58,7 +58,7 @@ Create `pruny.config.json` (optional):
|
|
|
58
58
|
|
|
59
59
|
## Features
|
|
60
60
|
|
|
61
|
-
- 🔍 Detects unused Next.js API routes
|
|
61
|
+
- 🔍 Detects unused Next.js API routes & Nest.js Controller methods
|
|
62
62
|
- 🗑️ `--fix` flag to delete unused routes
|
|
63
63
|
- ⚡ Auto-detects `vercel.json` cron routes
|
|
64
64
|
- 📁 Default ignores: `node_modules`, `.next`, `dist`, `.git`
|
|
@@ -66,10 +66,11 @@ Create `pruny.config.json` (optional):
|
|
|
66
66
|
|
|
67
67
|
## How it works
|
|
68
68
|
|
|
69
|
-
1. Finds all `app/api/**/route.ts` files
|
|
70
|
-
2.
|
|
71
|
-
3.
|
|
72
|
-
4.
|
|
69
|
+
1. **Next.js**: Finds all `app/api/**/route.ts` files.
|
|
70
|
+
2. **Nest.js**: Finds all `*.controller.ts` files and extracts mapped routes (e.g., `@Get('users')`).
|
|
71
|
+
3. Scans codebase for client-side usages (e.g., `fetch`, `axios`, or string literals matching the route).
|
|
72
|
+
4. Reports routes with no detected references.
|
|
73
|
+
5. `--fix` deletes the unused route file or method.
|
|
73
74
|
|
|
74
75
|
## License
|
|
75
76
|
|
package/dist/index.js
CHANGED
package/package.json
CHANGED