@m4x_7/type-debt 1.0.2 → 1.0.3

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/index.ts +66 -66
  2. package/package.json +3 -3
package/index.ts CHANGED
@@ -1,66 +1,66 @@
1
- #!/usr/bin/env node
2
-
3
- import { getTargetFiles } from "./utils.js";
4
- import { chunkArray, validateDirectory } from "./utils.js";
5
- import { processChunk } from "./core/chunkProcessor.js";
6
- import { FileReport } from "./types.js";
7
- import { CONSTANTS } from "./constants.js";
8
- import { generateMarkdownReport } from "./core/reporter.js";
9
-
10
-
11
-
12
- const args = process.argv.slice(2);
13
-
14
- if (args.includes('--help') || args.includes('-h')) {
15
- printHelp();
16
- process.exit(0);
17
- }
18
-
19
- const target = args[0] || ".";
20
-
21
- runCLI(target).catch((err) => {
22
- console.error(`\n\x1b[31m Error: ${err.message}\x1b[0m\n`);
23
- process.exit(1);
24
- });
25
-
26
-
27
- async function runCLI(targetDir: string) {
28
-
29
- await validateDirectory(targetDir);
30
-
31
- console.log(`\nScanning directory: ${targetDir}`);
32
- const allFiles = getTargetFiles(targetDir);
33
-
34
- if (allFiles.length === 0) {
35
- throw new Error(`No TypeScript files found to process.`);
36
- }
37
-
38
- const fileChunks = chunkArray(allFiles, CONSTANTS.CHUNK_SIZE);
39
-
40
- let allResults: FileReport[] = [];
41
-
42
- for (const [index, chunk] of fileChunks.entries()) {
43
-
44
- const chunkResults = processChunk(chunk);
45
- allResults = allResults.concat(chunkResults);
46
- process.stdout.write(`\rProcessed chunk ${index + 1}/${fileChunks.length}`);
47
- }
48
-
49
- await generateMarkdownReport(allResults, targetDir);
50
-
51
- }
52
-
53
- function printHelp() {
54
- console.log(`
55
- Type Debt Analyzer
56
-
57
- Usage: npx tsx index.ts [directory]
58
-
59
- Examples:
60
- npx tsx index.ts .
61
- npx tsx index.ts ./src
62
- `);
63
- process.exit(0);
64
- }
65
-
66
-
1
+ #!/usr/bin/env node
2
+
3
+ import { getTargetFiles } from "./utils.js";
4
+ import { chunkArray, validateDirectory } from "./utils.js";
5
+ import { processChunk } from "./core/chunkProcessor.js";
6
+ import { FileReport } from "./types.js";
7
+ import { CONSTANTS } from "./constants.js";
8
+ import { generateMarkdownReport } from "./core/reporter.js";
9
+
10
+
11
+
12
+ const args = process.argv.slice(2);
13
+
14
+ if (args.includes('--help') || args.includes('-h')) {
15
+ printHelp();
16
+ process.exit(0);
17
+ }
18
+
19
+ const target = args[0] || ".";
20
+
21
+ runCLI(target).catch((err) => {
22
+ console.error(`\n\x1b[31m Error: ${err.message}\x1b[0m\n`);
23
+ process.exit(1);
24
+ });
25
+
26
+
27
+ async function runCLI(targetDir: string) {
28
+
29
+ await validateDirectory(targetDir);
30
+
31
+ console.log(`\nScanning directory: ${targetDir}`);
32
+ const allFiles = getTargetFiles(targetDir);
33
+
34
+ if (allFiles.length === 0) {
35
+ throw new Error(`No TypeScript files found to process.`);
36
+ }
37
+
38
+ const fileChunks = chunkArray(allFiles, CONSTANTS.CHUNK_SIZE);
39
+
40
+ let allResults: FileReport[] = [];
41
+
42
+ for (const [index, chunk] of fileChunks.entries()) {
43
+
44
+ const chunkResults = processChunk(chunk);
45
+ allResults = allResults.concat(chunkResults);
46
+ process.stdout.write(`\rProcessed chunk ${index + 1}/${fileChunks.length}`);
47
+ }
48
+
49
+ await generateMarkdownReport(allResults, targetDir);
50
+
51
+ }
52
+
53
+ function printHelp() {
54
+ console.log(`
55
+ Type Debt Analyzer
56
+
57
+ Usage: npx tsx index.ts [directory]
58
+
59
+ Examples:
60
+ npx tsx index.ts .
61
+ npx tsx index.ts ./src
62
+ `);
63
+ process.exit(0);
64
+ }
65
+
66
+
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@m4x_7/type-debt",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "A high-performance TypeScript static analyzer that calculates Type Debt and generates reports.",
6
- "main": "./dist/index.js",
6
+ "main": "dist/index.js",
7
7
  "bin": {
8
- "type-debt": "./dist/index.js"
8
+ "type-debt": "dist/index.js"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "tsup index.ts --format esm --minify --clean",