dir-analysis-tool 1.0.5 → 2.0.6
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/LICENSE +21 -21
- package/README.md +195 -278
- package/dist/index.js +1310 -0
- package/package.json +42 -25
- package/bin/advanced-analysis.d.ts +0 -43
- package/bin/advanced-analysis.d.ts.map +0 -1
- package/bin/advanced-analysis.js +0 -185
- package/bin/advanced-analysis.js.map +0 -1
- package/bin/analyzer.d.ts +0 -40
- package/bin/analyzer.d.ts.map +0 -1
- package/bin/analyzer.js +0 -199
- package/bin/analyzer.js.map +0 -1
- package/bin/classifier.d.ts +0 -27
- package/bin/classifier.d.ts.map +0 -1
- package/bin/classifier.js +0 -63
- package/bin/classifier.js.map +0 -1
- package/bin/cli.d.ts +0 -2
- package/bin/cli.d.ts.map +0 -1
- package/bin/cli.js +0 -395
- package/bin/cli.js.map +0 -1
- package/bin/config.d.ts +0 -10
- package/bin/config.d.ts.map +0 -1
- package/bin/config.js +0 -94
- package/bin/config.js.map +0 -1
- package/bin/export.d.ts +0 -20
- package/bin/export.d.ts.map +0 -1
- package/bin/export.js +0 -51
- package/bin/export.js.map +0 -1
- package/bin/html-report.d.ts +0 -12
- package/bin/html-report.d.ts.map +0 -1
- package/bin/html-report.js +0 -691
- package/bin/html-report.js.map +0 -1
- package/bin/index.d.ts +0 -3
- package/bin/index.d.ts.map +0 -1
- package/bin/index.js +0 -5
- package/bin/index.js.map +0 -1
- package/bin/interactive.d.ts +0 -27
- package/bin/interactive.d.ts.map +0 -1
- package/bin/interactive.js +0 -635
- package/bin/interactive.js.map +0 -1
- package/bin/progress.d.ts +0 -9
- package/bin/progress.d.ts.map +0 -1
- package/bin/progress.js +0 -42
- package/bin/progress.js.map +0 -1
- package/bin/tree-view.d.ts +0 -21
- package/bin/tree-view.d.ts.map +0 -1
- package/bin/tree-view.js +0 -132
- package/bin/tree-view.js.map +0 -1
- package/bin/types.d.ts +0 -43
- package/bin/types.d.ts.map +0 -1
- package/bin/types.js +0 -3
- package/bin/types.js.map +0 -1
- package/bin/utils.d.ts +0 -24
- package/bin/utils.d.ts.map +0 -1
- package/bin/utils.js +0 -57
- package/bin/utils.js.map +0 -1
package/bin/html-report.js
DELETED
|
@@ -1,691 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HTMLReportGenerator = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
class HTMLReportGenerator {
|
|
7
|
-
static async generateReport(result, filename) {
|
|
8
|
-
let outputFile = filename || `directory-analysis-${new Date().toISOString().slice(0, 10)}.html`;
|
|
9
|
-
if (filename) {
|
|
10
|
-
try {
|
|
11
|
-
const stats = await fs_1.promises.stat(filename);
|
|
12
|
-
if (stats.isDirectory()) {
|
|
13
|
-
const path = require('path');
|
|
14
|
-
outputFile = path.join(filename, `directory-analysis-${new Date().toISOString().slice(0, 10)}.html`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
outputFile = filename;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const html = this.generateHTML(result);
|
|
22
|
-
await fs_1.promises.writeFile(outputFile, html);
|
|
23
|
-
return outputFile;
|
|
24
|
-
}
|
|
25
|
-
static generateHTML(result) {
|
|
26
|
-
return `<!DOCTYPE html>
|
|
27
|
-
<html lang="en">
|
|
28
|
-
<head>
|
|
29
|
-
<meta charset="UTF-8">
|
|
30
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
31
|
-
<title>Directory Analysis Report - ${result.path}</title>
|
|
32
|
-
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
33
|
-
<style>
|
|
34
|
-
${this.getCSS()}
|
|
35
|
-
</style>
|
|
36
|
-
</head>
|
|
37
|
-
<body>
|
|
38
|
-
<div class="container">
|
|
39
|
-
<header class="header">
|
|
40
|
-
<h1>📂 Directory Analysis Report</h1>
|
|
41
|
-
<p class="path">📍 ${result.path}</p>
|
|
42
|
-
<p class="timestamp">📅 Generated on ${new Date().toLocaleString()}</p>
|
|
43
|
-
</header>
|
|
44
|
-
|
|
45
|
-
<div class="summary-grid">
|
|
46
|
-
<div class="summary-card">
|
|
47
|
-
<div class="summary-icon">📦</div>
|
|
48
|
-
<div class="summary-content">
|
|
49
|
-
<h3>Total Size</h3>
|
|
50
|
-
<p class="summary-value">${(0, utils_1.formatSize)(result.totalSizeBytes)}</p>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
<div class="summary-card">
|
|
54
|
-
<div class="summary-icon">📄</div>
|
|
55
|
-
<div class="summary-content">
|
|
56
|
-
<h3>Files</h3>
|
|
57
|
-
<p class="summary-value">${result.files.toLocaleString()}</p>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="summary-card">
|
|
61
|
-
<div class="summary-icon">📁</div>
|
|
62
|
-
<div class="summary-content">
|
|
63
|
-
<h3>Folders</h3>
|
|
64
|
-
<p class="summary-value">${result.folders.toLocaleString()}</p>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
<div class="summary-card">
|
|
68
|
-
<div class="summary-icon">🗂️</div>
|
|
69
|
-
<div class="summary-content">
|
|
70
|
-
<h3>File Types</h3>
|
|
71
|
-
<p class="summary-value">${this.countNonZeroTypes(result.types)}</p>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<div class="charts-container">
|
|
77
|
-
<div class="chart-section">
|
|
78
|
-
<h2>📊 File Type Distribution</h2>
|
|
79
|
-
<div class="chart-wrapper">
|
|
80
|
-
<canvas id="fileTypeChart"></canvas>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
${result.topLargestFiles && result.topLargestFiles.length > 0 ? `
|
|
85
|
-
<div class="chart-section">
|
|
86
|
-
<h2>📈 Largest Files</h2>
|
|
87
|
-
<div class="chart-wrapper">
|
|
88
|
-
<canvas id="largestFilesChart"></canvas>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
` : ''}
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
${result.largeFiles && result.largeFiles.length > 0 ? `
|
|
95
|
-
<div class="section">
|
|
96
|
-
<h2>🚨 Large Files</h2>
|
|
97
|
-
<div class="table-wrapper">
|
|
98
|
-
<table class="data-table">
|
|
99
|
-
<thead>
|
|
100
|
-
<tr>
|
|
101
|
-
<th>File Path</th>
|
|
102
|
-
<th>Size</th>
|
|
103
|
-
</tr>
|
|
104
|
-
</thead>
|
|
105
|
-
<tbody>
|
|
106
|
-
${result.largeFiles.slice(0, 20).map(file => `
|
|
107
|
-
<tr>
|
|
108
|
-
<td class="file-path">${this.escapeHtml(file.path)}</td>
|
|
109
|
-
<td class="file-size">${file.sizeFormatted}</td>
|
|
110
|
-
</tr>
|
|
111
|
-
`).join('')}
|
|
112
|
-
</tbody>
|
|
113
|
-
</table>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
` : ''}
|
|
117
|
-
|
|
118
|
-
${result.duplicateGroups && result.duplicateGroups.length > 0 ? `
|
|
119
|
-
<div class="section">
|
|
120
|
-
<h2>🔄 Duplicate Files</h2>
|
|
121
|
-
<div class="duplicate-stats">
|
|
122
|
-
<p>📊 Total Groups: <strong>${result.duplicateGroups.length}</strong></p>
|
|
123
|
-
${result.duplicateStats ? `
|
|
124
|
-
<p>💾 Wasted Space: <strong>${result.duplicateStats.totalWastedSpaceFormatted}</strong></p>
|
|
125
|
-
` : ''}
|
|
126
|
-
</div>
|
|
127
|
-
<div class="duplicate-groups">
|
|
128
|
-
${result.duplicateGroups.slice(0, 10).map((group, index) => `
|
|
129
|
-
<div class="duplicate-group">
|
|
130
|
-
<h4>Group ${index + 1} - ${group.sizeFormatted} each × ${group.files.length} files</h4>
|
|
131
|
-
<ul class="duplicate-files">
|
|
132
|
-
${group.files.slice(0, 5).map(file => `
|
|
133
|
-
<li class="duplicate-file">${this.escapeHtml(file)}</li>
|
|
134
|
-
`).join('')}
|
|
135
|
-
${group.files.length > 5 ? `
|
|
136
|
-
<li class="more-files">... and ${group.files.length - 5} more files</li>
|
|
137
|
-
` : ''}
|
|
138
|
-
</ul>
|
|
139
|
-
</div>
|
|
140
|
-
`).join('')}
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
` : ''}
|
|
144
|
-
|
|
145
|
-
${result.emptyFiles && result.emptyFiles.length > 0 ? `
|
|
146
|
-
<div class="section">
|
|
147
|
-
<h2>📭 Empty Files</h2>
|
|
148
|
-
<div class="table-wrapper">
|
|
149
|
-
<table class="data-table">
|
|
150
|
-
<thead>
|
|
151
|
-
<tr>
|
|
152
|
-
<th>File Path</th>
|
|
153
|
-
<th>Modified Date</th>
|
|
154
|
-
</tr>
|
|
155
|
-
</thead>
|
|
156
|
-
<tbody>
|
|
157
|
-
${result.emptyFiles.slice(0, 20).map(file => `
|
|
158
|
-
<tr>
|
|
159
|
-
<td class="file-path">${this.escapeHtml(file.path)}</td>
|
|
160
|
-
<td class="file-date">${file.modifiedDate.toLocaleDateString()}</td>
|
|
161
|
-
</tr>
|
|
162
|
-
`).join('')}
|
|
163
|
-
</tbody>
|
|
164
|
-
</table>
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
` : ''}
|
|
168
|
-
|
|
169
|
-
<footer class="footer">
|
|
170
|
-
<p>Generated by Dir Analyzer v1.0.0</p>
|
|
171
|
-
</footer>
|
|
172
|
-
</div>
|
|
173
|
-
|
|
174
|
-
<script>
|
|
175
|
-
${this.getJavaScript(result)}
|
|
176
|
-
</script>
|
|
177
|
-
</body>
|
|
178
|
-
</html>`;
|
|
179
|
-
}
|
|
180
|
-
static getCSS() {
|
|
181
|
-
return `
|
|
182
|
-
* {
|
|
183
|
-
margin: 0;
|
|
184
|
-
padding: 0;
|
|
185
|
-
box-sizing: border-box;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
body {
|
|
189
|
-
font-family: 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
|
|
190
|
-
line-height: 1.6;
|
|
191
|
-
color: #00ff00;
|
|
192
|
-
background: #0a0a0a;
|
|
193
|
-
min-height: 100vh;
|
|
194
|
-
background-image:
|
|
195
|
-
linear-gradient(90deg, rgba(0,255,0,0.03) 1px, transparent 1px),
|
|
196
|
-
linear-gradient(rgba(0,255,0,0.03) 1px, transparent 1px);
|
|
197
|
-
background-size: 20px 20px;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.container {
|
|
201
|
-
max-width: 1200px;
|
|
202
|
-
margin: 0 auto;
|
|
203
|
-
padding: 20px;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.header {
|
|
207
|
-
background: #1a1a1a;
|
|
208
|
-
padding: 30px;
|
|
209
|
-
border: 2px solid #00ff00;
|
|
210
|
-
border-radius: 8px;
|
|
211
|
-
box-shadow: 0 0 20px rgba(0,255,0,0.3);
|
|
212
|
-
margin-bottom: 30px;
|
|
213
|
-
text-align: center;
|
|
214
|
-
position: relative;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.header::before {
|
|
218
|
-
content: '> ';
|
|
219
|
-
position: absolute;
|
|
220
|
-
left: 15px;
|
|
221
|
-
top: 15px;
|
|
222
|
-
color: #00ff00;
|
|
223
|
-
font-weight: bold;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.header h1 {
|
|
227
|
-
font-size: 2.5em;
|
|
228
|
-
margin-bottom: 10px;
|
|
229
|
-
color: #00ff00;
|
|
230
|
-
text-shadow: 0 0 10px rgba(0,255,0,0.5);
|
|
231
|
-
font-weight: bold;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.path {
|
|
235
|
-
font-size: 1.2em;
|
|
236
|
-
color: #00cccc;
|
|
237
|
-
margin-bottom: 5px;
|
|
238
|
-
font-family: 'Fira Code', monospace;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.timestamp {
|
|
242
|
-
color: #666;
|
|
243
|
-
font-family: 'Fira Code', monospace;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.summary-grid {
|
|
247
|
-
display: grid;
|
|
248
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
249
|
-
gap: 20px;
|
|
250
|
-
margin-bottom: 30px;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.summary-card {
|
|
254
|
-
background: #1a1a1a;
|
|
255
|
-
padding: 25px;
|
|
256
|
-
border: 1px solid #333;
|
|
257
|
-
border-radius: 8px;
|
|
258
|
-
box-shadow: 0 0 15px rgba(0,255,0,0.1);
|
|
259
|
-
display: flex;
|
|
260
|
-
align-items: center;
|
|
261
|
-
transition: all 0.3s ease;
|
|
262
|
-
position: relative;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.summary-card::before {
|
|
266
|
-
content: '$ ';
|
|
267
|
-
position: absolute;
|
|
268
|
-
left: 10px;
|
|
269
|
-
top: 10px;
|
|
270
|
-
color: #00ff00;
|
|
271
|
-
font-size: 0.9em;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.summary-card:hover {
|
|
275
|
-
border-color: #00ff00;
|
|
276
|
-
box-shadow: 0 0 25px rgba(0,255,0,0.3);
|
|
277
|
-
transform: translateY(-2px);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.summary-icon {
|
|
281
|
-
font-size: 3em;
|
|
282
|
-
margin-right: 20px;
|
|
283
|
-
filter: grayscale(1) brightness(1.5);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.summary-content h3 {
|
|
287
|
-
color: #00cccc;
|
|
288
|
-
margin-bottom: 5px;
|
|
289
|
-
text-transform: uppercase;
|
|
290
|
-
letter-spacing: 1px;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.summary-value {
|
|
294
|
-
font-size: 2em;
|
|
295
|
-
font-weight: bold;
|
|
296
|
-
color: #00ff00;
|
|
297
|
-
text-shadow: 0 0 5px rgba(0,255,0,0.5);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.charts-container {
|
|
301
|
-
display: grid;
|
|
302
|
-
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
|
303
|
-
gap: 30px;
|
|
304
|
-
margin-bottom: 30px;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.chart-section {
|
|
308
|
-
background: #1a1a1a;
|
|
309
|
-
padding: 25px;
|
|
310
|
-
border: 1px solid #333;
|
|
311
|
-
border-radius: 8px;
|
|
312
|
-
box-shadow: 0 0 15px rgba(0,255,0,0.1);
|
|
313
|
-
position: relative;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.chart-section::before {
|
|
317
|
-
content: '>> ';
|
|
318
|
-
position: absolute;
|
|
319
|
-
left: 10px;
|
|
320
|
-
top: 10px;
|
|
321
|
-
color: #00ff00;
|
|
322
|
-
font-size: 0.9em;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.chart-section h2 {
|
|
326
|
-
margin-bottom: 20px;
|
|
327
|
-
color: #00ff00;
|
|
328
|
-
text-transform: uppercase;
|
|
329
|
-
letter-spacing: 1px;
|
|
330
|
-
border-bottom: 2px solid #00ff00;
|
|
331
|
-
padding-bottom: 10px;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.chart-wrapper {
|
|
335
|
-
position: relative;
|
|
336
|
-
height: 300px;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
.section {
|
|
340
|
-
background: #1a1a1a;
|
|
341
|
-
padding: 25px;
|
|
342
|
-
border: 1px solid #333;
|
|
343
|
-
border-radius: 8px;
|
|
344
|
-
box-shadow: 0 0 15px rgba(0,255,0,0.1);
|
|
345
|
-
margin-bottom: 30px;
|
|
346
|
-
position: relative;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.section::before {
|
|
350
|
-
content: '>>> ';
|
|
351
|
-
position: absolute;
|
|
352
|
-
left: 10px;
|
|
353
|
-
top: 10px;
|
|
354
|
-
color: #00ff00;
|
|
355
|
-
font-size: 0.9em;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.section h2 {
|
|
359
|
-
margin-bottom: 20px;
|
|
360
|
-
color: #00ff00;
|
|
361
|
-
border-bottom: 2px solid #00ff00;
|
|
362
|
-
padding-bottom: 10px;
|
|
363
|
-
text-transform: uppercase;
|
|
364
|
-
letter-spacing: 1px;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.table-wrapper {
|
|
368
|
-
overflow-x: auto;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
.data-table {
|
|
372
|
-
width: 100%;
|
|
373
|
-
border-collapse: collapse;
|
|
374
|
-
margin-top: 10px;
|
|
375
|
-
border: 1px solid #333;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.data-table th,
|
|
379
|
-
.data-table td {
|
|
380
|
-
padding: 12px;
|
|
381
|
-
text-align: left;
|
|
382
|
-
border-bottom: 1px solid #333;
|
|
383
|
-
border-right: 1px solid #333;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
.data-table th {
|
|
387
|
-
background: #0d0d0d;
|
|
388
|
-
font-weight: 600;
|
|
389
|
-
color: #00cccc;
|
|
390
|
-
text-transform: uppercase;
|
|
391
|
-
letter-spacing: 1px;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.data-table tr:hover {
|
|
395
|
-
background: #2a2a2a;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.file-path {
|
|
399
|
-
font-family: 'Fira Code', 'Consolas', monospace;
|
|
400
|
-
font-size: 0.9em;
|
|
401
|
-
color: #00ff00;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.file-size {
|
|
405
|
-
font-weight: 600;
|
|
406
|
-
color: #ff6b6b;
|
|
407
|
-
font-family: 'Fira Code', monospace;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
.file-date {
|
|
411
|
-
color: #666;
|
|
412
|
-
font-family: 'Fira Code', monospace;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
.duplicate-stats {
|
|
416
|
-
background: #0d0d0d;
|
|
417
|
-
padding: 15px;
|
|
418
|
-
border: 1px solid #333;
|
|
419
|
-
border-radius: 4px;
|
|
420
|
-
margin-bottom: 20px;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
.duplicate-group {
|
|
424
|
-
border: 1px solid #333;
|
|
425
|
-
border-radius: 4px;
|
|
426
|
-
margin-bottom: 15px;
|
|
427
|
-
padding: 15px;
|
|
428
|
-
background: #0d0d0d;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
.duplicate-group h4 {
|
|
432
|
-
color: #00cccc;
|
|
433
|
-
margin-bottom: 10px;
|
|
434
|
-
font-family: 'Fira Code', monospace;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
.duplicate-files {
|
|
438
|
-
list-style: none;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.duplicate-file {
|
|
442
|
-
padding: 5px 0;
|
|
443
|
-
font-family: 'Fira Code', monospace;
|
|
444
|
-
font-size: 0.9em;
|
|
445
|
-
color: #00ff00;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.duplicate-file::before {
|
|
449
|
-
content: ' - ';
|
|
450
|
-
color: #666;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
.more-files {
|
|
454
|
-
padding: 5px 0;
|
|
455
|
-
color: #666;
|
|
456
|
-
font-style: italic;
|
|
457
|
-
font-family: 'Fira Code', monospace;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.footer {
|
|
461
|
-
text-align: center;
|
|
462
|
-
padding: 20px;
|
|
463
|
-
color: #666;
|
|
464
|
-
font-size: 0.9em;
|
|
465
|
-
font-family: 'Fira Code', monospace;
|
|
466
|
-
border-top: 1px solid #333;
|
|
467
|
-
margin-top: 30px;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
.footer::before {
|
|
471
|
-
content: '~$ ';
|
|
472
|
-
color: #00ff00;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
@media (max-width: 768px) {
|
|
476
|
-
.container {
|
|
477
|
-
padding: 10px;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
.header h1 {
|
|
481
|
-
font-size: 2em;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
.summary-grid {
|
|
485
|
-
grid-template-columns: 1fr;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.charts-container {
|
|
489
|
-
grid-template-columns: 1fr;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.summary-card {
|
|
493
|
-
text-align: center;
|
|
494
|
-
flex-direction: column;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
.summary-icon {
|
|
498
|
-
margin-right: 0;
|
|
499
|
-
margin-bottom: 10px;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
`;
|
|
503
|
-
}
|
|
504
|
-
static getJavaScript(result) {
|
|
505
|
-
const fileTypeData = this.getFileTypeChartData(result.types);
|
|
506
|
-
const largestFilesData = this.getLargestFilesChartData(result.topLargestFiles);
|
|
507
|
-
return `
|
|
508
|
-
const fileTypeCtx = document.getElementById('fileTypeChart').getContext('2d');
|
|
509
|
-
new Chart(fileTypeCtx, {
|
|
510
|
-
type: 'doughnut',
|
|
511
|
-
data: {
|
|
512
|
-
labels: ${JSON.stringify(fileTypeData.labels)},
|
|
513
|
-
datasets: [{
|
|
514
|
-
data: ${JSON.stringify(fileTypeData.data)},
|
|
515
|
-
backgroundColor: [
|
|
516
|
-
'#00ff00', '#00cccc', '#ffff00', '#ff6b6b',
|
|
517
|
-
'#9966ff', '#ff9900', '#66ff66', '#ff3366'
|
|
518
|
-
],
|
|
519
|
-
borderColor: '#0a0a0a',
|
|
520
|
-
borderWidth: 2
|
|
521
|
-
}]
|
|
522
|
-
},
|
|
523
|
-
options: {
|
|
524
|
-
responsive: true,
|
|
525
|
-
maintainAspectRatio: false,
|
|
526
|
-
plugins: {
|
|
527
|
-
legend: {
|
|
528
|
-
position: 'bottom',
|
|
529
|
-
labels: {
|
|
530
|
-
padding: 20,
|
|
531
|
-
usePointStyle: true,
|
|
532
|
-
color: '#00ff00',
|
|
533
|
-
font: {
|
|
534
|
-
family: 'Fira Code, Consolas, Monaco, monospace',
|
|
535
|
-
size: 12
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
tooltip: {
|
|
540
|
-
backgroundColor: '#1a1a1a',
|
|
541
|
-
titleColor: '#00ff00',
|
|
542
|
-
bodyColor: '#00cccc',
|
|
543
|
-
borderColor: '#333',
|
|
544
|
-
borderWidth: 1,
|
|
545
|
-
titleFont: {
|
|
546
|
-
family: 'Fira Code, Consolas, Monaco, monospace'
|
|
547
|
-
},
|
|
548
|
-
bodyFont: {
|
|
549
|
-
family: 'Fira Code, Consolas, Monaco, monospace'
|
|
550
|
-
},
|
|
551
|
-
callbacks: {
|
|
552
|
-
label: function(context) {
|
|
553
|
-
const label = context.label || '';
|
|
554
|
-
const value = context.parsed;
|
|
555
|
-
const total = context.dataset.data.reduce((a, b) => a + b, 0);
|
|
556
|
-
const percentage = ((value / total) * 100).toFixed(1);
|
|
557
|
-
return label + ': ' + value + ' files (' + percentage + '%)';
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
${result.topLargestFiles && result.topLargestFiles.length > 0 ? `
|
|
566
|
-
const largestFilesCtx = document.getElementById('largestFilesChart').getContext('2d');
|
|
567
|
-
new Chart(largestFilesCtx, {
|
|
568
|
-
type: 'bar',
|
|
569
|
-
data: {
|
|
570
|
-
labels: ${JSON.stringify(largestFilesData.labels)},
|
|
571
|
-
datasets: [{
|
|
572
|
-
label: 'File Size',
|
|
573
|
-
data: ${JSON.stringify(largestFilesData.data)},
|
|
574
|
-
backgroundColor: '#00ff00',
|
|
575
|
-
borderColor: '#00cccc',
|
|
576
|
-
borderWidth: 1
|
|
577
|
-
}]
|
|
578
|
-
},
|
|
579
|
-
options: {
|
|
580
|
-
responsive: true,
|
|
581
|
-
maintainAspectRatio: false,
|
|
582
|
-
scales: {
|
|
583
|
-
y: {
|
|
584
|
-
beginAtZero: true,
|
|
585
|
-
ticks: {
|
|
586
|
-
color: '#00ff00',
|
|
587
|
-
font: {
|
|
588
|
-
family: 'Fira Code, Consolas, Monaco, monospace'
|
|
589
|
-
},
|
|
590
|
-
callback: function(value) {
|
|
591
|
-
return formatBytes(value);
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
grid: {
|
|
595
|
-
color: '#333'
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
x: {
|
|
599
|
-
ticks: {
|
|
600
|
-
color: '#00ff00',
|
|
601
|
-
font: {
|
|
602
|
-
family: 'Fira Code, Consolas, Monaco, monospace'
|
|
603
|
-
},
|
|
604
|
-
maxRotation: 45,
|
|
605
|
-
minRotation: 45
|
|
606
|
-
},
|
|
607
|
-
grid: {
|
|
608
|
-
color: '#333'
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
},
|
|
612
|
-
plugins: {
|
|
613
|
-
legend: {
|
|
614
|
-
display: false
|
|
615
|
-
},
|
|
616
|
-
tooltip: {
|
|
617
|
-
backgroundColor: '#1a1a1a',
|
|
618
|
-
titleColor: '#00ff00',
|
|
619
|
-
bodyColor: '#00cccc',
|
|
620
|
-
borderColor: '#333',
|
|
621
|
-
borderWidth: 1,
|
|
622
|
-
titleFont: {
|
|
623
|
-
family: 'Fira Code, Consolas, Monaco, monospace'
|
|
624
|
-
},
|
|
625
|
-
bodyFont: {
|
|
626
|
-
family: 'Fira Code, Consolas, Monaco, monospace'
|
|
627
|
-
},
|
|
628
|
-
callbacks: {
|
|
629
|
-
label: function(context) {
|
|
630
|
-
return 'Size: ' + formatBytes(context.parsed.y);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
` : ''}
|
|
638
|
-
|
|
639
|
-
function formatBytes(bytes) {
|
|
640
|
-
if (bytes === 0) return '0 Bytes';
|
|
641
|
-
const k = 1024;
|
|
642
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
643
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
644
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
645
|
-
}
|
|
646
|
-
`;
|
|
647
|
-
}
|
|
648
|
-
static getFileTypeChartData(types) {
|
|
649
|
-
const typeMapping = {
|
|
650
|
-
code: '🧑💻 Code',
|
|
651
|
-
images: '📷 Images',
|
|
652
|
-
documents: '📄 Documents',
|
|
653
|
-
videos: '🎬 Videos',
|
|
654
|
-
audio: '🎵 Audio',
|
|
655
|
-
archives: '🗃️ Archives',
|
|
656
|
-
other: '❓ Other'
|
|
657
|
-
};
|
|
658
|
-
const labels = [];
|
|
659
|
-
const data = [];
|
|
660
|
-
Object.entries(types).forEach(([key, value]) => {
|
|
661
|
-
if (value > 0) {
|
|
662
|
-
labels.push(typeMapping[key] || key);
|
|
663
|
-
data.push(value);
|
|
664
|
-
}
|
|
665
|
-
});
|
|
666
|
-
return { labels, data };
|
|
667
|
-
}
|
|
668
|
-
static getLargestFilesChartData(topFiles) {
|
|
669
|
-
if (!topFiles || topFiles.length === 0) {
|
|
670
|
-
return { labels: [], data: [] };
|
|
671
|
-
}
|
|
672
|
-
const labels = topFiles.map(file => {
|
|
673
|
-
const fileName = file.path.split(/[/\\]/).pop() || file.path;
|
|
674
|
-
return fileName.length > 20 ? fileName.substring(0, 17) + '...' : fileName;
|
|
675
|
-
});
|
|
676
|
-
const data = topFiles.map(file => file.size);
|
|
677
|
-
return { labels, data };
|
|
678
|
-
}
|
|
679
|
-
static countNonZeroTypes(types) {
|
|
680
|
-
return Object.values(types).filter(count => count > 0).length;
|
|
681
|
-
}
|
|
682
|
-
static escapeHtml(text) {
|
|
683
|
-
return text
|
|
684
|
-
.replace(/&/g, '&')
|
|
685
|
-
.replace(/</g, '<').replace(/>/g, '>')
|
|
686
|
-
.replace(/"/g, '"')
|
|
687
|
-
.replace(/'/g, ''');
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
exports.HTMLReportGenerator = HTMLReportGenerator;
|
|
691
|
-
//# sourceMappingURL=html-report.js.map
|
package/bin/html-report.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html-report.js","sourceRoot":"","sources":["../src/html-report.ts"],"names":[],"mappings":";;;AACA,mCAAqC;AACrC,2BAAoC;AAEpC,MAAa,mBAAmB;IAC5B,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,MAA8B,EAAE,QAAiB;QACzE,IAAI,UAAU,GAAG,QAAQ,IAAI,sBAAsB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC;QAEhG,IAAI,QAAQ,EAAE,CAAC;YACX,IAAI,CAAC;gBACD,MAAM,KAAK,GAAG,MAAM,aAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACtB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;oBAC7B,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,sBAAsB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;gBACzG,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,UAAU,GAAG,QAAQ,CAAC;YAC1B,CAAC;Q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