This project is designed to analyze function calls within a JavaScript project and generate visual diagrams of the function call hierarchy using Mermaid.
Note: Currently, this tool only supports .js and .vue files
default.mp4
functions-call-graph-with-filter:

- Extracts all user defined functions from the project.
- Analyzes function calls within the project.
- Generates JSON files containing function call data.
- Creates visual diagrams using Mermaid.
- Filters diagrams based on specified criteria.
-
Clone the repository:
git clone https://github.com/SartreShao/function-visualization.git cd function-visualization
-
Install dependencies:
npm install
- Update the
mainfunction parameters inindex.js:
// replace with the project directory you need to analyze
const directoryPath = "C:/Code/server/easylink.server";
// replace with the folders in the project directory that need to be ignored
const ignoreFolders = ["node_modules", "dist", "public"];
// replace with the name of the function you need to analyze
// case insensitive, it doesn't even need to be the complete function name, just a part of the function name
const filterText = "easyfile";
- Run the script:
npm start
-
The results will be generated in the following files:
diagram-all-function.mmd: A call graph of all user-defined functions in the specified folder.diagram-filter-function.mmd: A call graph of functions related to the filter word in the specified folder.
-
Process files generated by the program can be ignored:
result.json: JSON file containing all function calls.diagram-id.mmd: Mermaid diagram with function IDs.
