Skip to content

Commit 86aafa4

Browse files
Add comprehensive README with project overview and usage examples
1 parent 69f6d90 commit 86aafa4

File tree

7 files changed

+56
-21
lines changed

7 files changed

+56
-21
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# TypeScript Code Extractor and Analyzer
2+
3+
This project provides a robust toolkit for extracting, analyzing, and mapping TypeScript code structures.
4+
5+
The TypeScript Code Extractor and Analyzer is a comprehensive solution designed to parse and analyze TypeScript codebases. It offers a set of tools to extract detailed information about classes, interfaces, functions, and other TypeScript constructs, enabling developers to gain deep insights into their codebase structure and dependencies.
6+
7+
Key features include:
8+
9+
- Extraction of class metadata, including methods, properties, interfaces, and enums
10+
- Function and method analysis, including parameter extraction and return type inference
11+
- Interface and enum information extraction
12+
- Dependency graph generation for TypeScript files
13+
14+
## Repository Structure
15+
16+
```
17+
.
18+
├── src/
19+
│ ├── core/
20+
│ ├── Example/
21+
│ ├── http/
22+
│ ├── infrastructure/
23+
│ ├── interfaces/
24+
│ ├── logger/
25+
│ ├── result/
26+
│ ├── services/
27+
│ └── utils/
28+
├── CHANGELOG.md
29+
├── jest.config.js
30+
├── package.json
31+
├── README.md
32+
└── tsconfig.json
33+
```
34+
35+
### Code Analysis
36+
37+
To analyze a TypeScript codebase:
38+
39+
```typescript
40+
import { TypeScriptCodeMapper } from "./src/services/typescript-code-mapper.service";
41+
42+
const codeMapper = new TypeScriptCodeMapper();
43+
44+
// Build a codebase map
45+
const codebaseMap = await codeMapper.buildCodebaseMap();
46+
47+
// Extract class metadata
48+
const classInfo = codeMapper.extractClassMetaData(classNode, sourceFile);
49+
50+
// Build a dependency graph
51+
const dependencies = codeMapper.buildDependencyGraph(sourceFile);
52+
```

src/core/constants.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
export const MEMORY_CACHE_OPTIONS = {
2-
serviceName: "SharedKernel",
3-
accountName: "UserSession",
4-
sessionTTL: 24 * 60 * 60 * 1000,
5-
};
6-
71
export enum RequestHeader {
82
AUTHORIZATION = "authorization",
93
CONTENT_TYPE = "Content-Type",

src/http/http-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { IRequestOptions } from "./../../dist/interfaces/generic.interface.d";
12
import * as https from "https";
23
import { ClientRequest } from "http";
34
import { IHttpClient } from "./http-service.interface";
45
import { ApplicationLogger } from "../logger/logger-service";
56
import { HTTP_VERBS, RequestHeader } from "../core/constants";
6-
import { IRequestOptions } from "../interfaces";
77
/**
88
* A custom HTTP client implementation that provides a set of methods for sending HTTP requests.
99
* This client supports GET, POST, PUT, and DELETE requests, and allows for optional request options and payload.

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export * from "./result";
77
export * from "./interfaces";
88
export * from "./utils";
99
export * from "./core";
10+
export * from "./services";
1011

1112
getCodeBase();

src/interfaces/generic.interface.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
import { RequestHeader } from "../core/constants";
2-
3-
export type HeadersType = {
4-
[key in keyof RequestHeader]: string;
5-
};
6-
7-
export interface IRequestOptions {
8-
hostname: string;
9-
path: string;
10-
method: string;
11-
headers?: any;
12-
jwtToken?: string;
13-
}
14-
151
import ts from "typescript";
162

173
export interface IFunctionInfo {

src/interfaces/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "./generic.interface";
2+
export * from "./ts.code.mapper.interface";

src/services/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./typescript-code-mapper.service";

0 commit comments

Comments
 (0)