Phases Plan
Phases Plan
Since database creation and population are not the focus right now, we will only focus on
extracting the required attributes from a React project. Below is a fully optimized toolchain
covering all necessary extractions.
🛠 Tools:
Task Tool(s) Purpose
Scan Project Files & Locate Node.js fs + Find all .jsx and .tsx files.
Components Globby
✅ Best Approach: Use Globby to scan files → Feed results into Madge for relationships.
🛠 Tools:
Task Tool(s) Purpose
🛠 Tools:
Task Tool(s) Purpose
Detect Prop Type Checking Babel Parser + Find propTypes & TypeScript
(PropTypes/TS Types) TSQuery interfaces.
✅ Best Approach: Use React-Docs-Gen for parsing props → TSQuery for TypeScript
analysis.
🛠 Tools:
Task Tool(s) Purpose
Find useReducer & Associated ESLint Custom Locate state management logic.
Reducers Rule
✅ Best Approach: Use Babel Parser for hooks & state → TSQuery for Context API.
🔹 PHASE 5: Extract Routing Information (Routes Table)
Goal: Extract all routes, their paths, and associated components.
🛠 Tools:
Task Tool(s) Purpose
Extract <Routes> and <Route> Babel Parser Parse JSX route definitions.
Components
Extract Dynamic Params & 404 React Router Detect dynamic routes &
Handling DevTools fallback routes.
✅ Best Approach: Use Babel Parser to extract routes → React Router DevTools for
runtime validation.
🛠 Tools:
Task Tool(s) Purpose
Find fetch() and axios Calls ESLint Custom Locate API requests.
Rule
Extract API Endpoints & Babel Parser Parse URLs inside API calls.
Methods
✅ Best Approach: Use ESLint Custom Rule for API detection → TS Compiler for
request/response structures.
🔹 PHASE 7: Extract Hooks Usage (Hooks Table)
Goal: Identify all built-in and custom hooks used.
🛠 Tools:
Task Tool(s) Purpose
✅ Best Approach: Use Babel Parser for built-in hooks → TSQuery for custom hooks.
🛠 Tools:
Task Tool(s) Purpose
Find Images, Fonts, and Files FastGlob Scan directories for asset
files.
✅ Best Approach: Use FastGlob for asset scanning → npm ls for dependencies.
🚀 FINALIZED TOOLCHAIN
Phase Tools Used
💡 Next Steps
Would you like:
You said:
For now, I want you to use this finalized toolchain, and generate a code, that would simply use
these toolchain Tools and generate a json file which would be a component table and contain
Components-table attributes (I have provided table attributes earlier). First tell the steps, how
are we going to generate the code. These steps would explain lots of things including what
toolchain will be used for which logic/problem and so on.
ChatGPT said:
🔍 Logic:
🛠 Toolchain Used:
Tool Purpose
🔍 Logic:
1. Read the component file content.
2. Use Babel Parser to convert the file into an AST (Abstract Syntax Tree).
3. Look for:
○ Function Declarations (for functional components).
○ Class Declarations (for class-based components).
○ Variable Declarations with ArrowFunctionExpression (for functional
components assigned to variables).
4. Extract:
○ Component Name (name)
○ Component Type (functional or class-based)
○ File Path (file_path)
○ Description (from comments, if available).
🔹 Step 3: Extract Parent-Child Relationships
Goal: Identify component dependencies (parent-child relations).
🛠 Toolchain Used:
Tool Purpose
🔍 Logic:
🛠 Toolchain Used:
Tool Purpose
🔍 Logic:
1. Collect all extracted component attributes.
2. Structure them as per Components Table schema.
3. Save the JSON file.
1. Scan for Components Find .tsx / .jsx files Node.js fs, Globby
2. Parse Component Extract component Babel Parser,
Files metadata JSCodeshift
💡 Next Steps
Now, I will generate a Node.js script that will implement these steps and output a JSON file
containing Components Table attributes. 🚀
Let me know if you have any modifications before I proceed with the code! 🔥