@saismrutiranjan18/why-slow 1.0.0 → 1.0.2
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 +125 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# why-slow
|
|
2
|
+
|
|
3
|
+
> Diagnose why your Node.js project is slow — in seconds.
|
|
4
|
+
|
|
5
|
+
`why-slow` is a zero-config CLI tool that scans your project and gives you an instant performance report: large source files, oversized images, circular dependencies, and unused packages.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Run instantly without installing
|
|
13
|
+
npx @saismrutiranjan18/why-slow
|
|
14
|
+
|
|
15
|
+
# Or install globally
|
|
16
|
+
npm install -g @saismrutiranjan18/why-slow
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Run in any project directory
|
|
25
|
+
why-slow
|
|
26
|
+
|
|
27
|
+
# Generate an HTML report
|
|
28
|
+
why-slow --html
|
|
29
|
+
|
|
30
|
+
# Show help
|
|
31
|
+
why-slow --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## What it checks
|
|
37
|
+
|
|
38
|
+
| Check | What it flags |
|
|
39
|
+
|---|---|
|
|
40
|
+
| **Large Source Files** | `.js/.ts/.jsx/.tsx` files over **200 KB** |
|
|
41
|
+
| **Large Images** | Images over **500 KB** (png, jpg, webp, svg) |
|
|
42
|
+
| **Circular Dependencies** | Modules that import each other in a loop |
|
|
43
|
+
| **Unused Dependencies** | Packages in `package.json` not used in code |
|
|
44
|
+
| **node_modules Size** | Total size of your installed dependencies |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Example Output
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
WHY-SLOW v1.1
|
|
52
|
+
────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
i Largest Source Files
|
|
55
|
+
✓ No oversized source files found
|
|
56
|
+
|
|
57
|
+
i Image Analysis
|
|
58
|
+
! public/banner.png (1.2 MB)
|
|
59
|
+
|
|
60
|
+
i Circular Dependencies
|
|
61
|
+
✖ src/utils/format.js → src/helpers/date.js → src/utils/format.js
|
|
62
|
+
|
|
63
|
+
i Unused Dependencies
|
|
64
|
+
! lodash
|
|
65
|
+
! moment
|
|
66
|
+
|
|
67
|
+
i Dependencies
|
|
68
|
+
i node_modules size: 214.5 MB
|
|
69
|
+
|
|
70
|
+
────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
Performance Summary
|
|
73
|
+
|
|
74
|
+
i Large Files: 0
|
|
75
|
+
i Large Images: 1
|
|
76
|
+
i Circular Dependencies: 1
|
|
77
|
+
i Unused Dependencies: 2
|
|
78
|
+
|
|
79
|
+
! Performance Score: 79/100
|
|
80
|
+
|
|
81
|
+
────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
Scan completed successfully.
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## HTML Report
|
|
89
|
+
|
|
90
|
+
Run with `--html` to generate a `performance-report.html` file in your project root — a clean, shareable report with all findings.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
why-slow --html
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Performance Score
|
|
99
|
+
|
|
100
|
+
Your project gets a score out of **100**:
|
|
101
|
+
|
|
102
|
+
| Issue | Penalty |
|
|
103
|
+
|---|---|
|
|
104
|
+
| Each large source file | −5 pts |
|
|
105
|
+
| Each large image | −5 pts |
|
|
106
|
+
| Each circular dependency | −10 pts |
|
|
107
|
+
| Each unused dependency | −2 pts |
|
|
108
|
+
|
|
109
|
+
| Score | Rating |
|
|
110
|
+
|---|---|
|
|
111
|
+
| 90–100 | Great |
|
|
112
|
+
| 70–89 | Needs attention |
|
|
113
|
+
| 0–69 | Action required |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Requirements
|
|
118
|
+
|
|
119
|
+
- Node.js **18+**
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT © [saismrutiranjan18](https://github.com/saismrutiranjan18)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saismrutiranjan18/why-slow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "CLI tool to diagnose why your Node.js project is slow — scans for large files, oversized images, circular dependencies, and unused packages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "https://github.com/saismrutiranjan18/npm-workspace"
|
|
27
|
+
"url": "https://github.com/saismrutiranjan18/npm-workspace/tree/main/why-slow"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=18.0.0"
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
"fs-extra": "^11.3.5",
|
|
37
37
|
"madge": "^8.0.0"
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|