Some of our projects mainly consists of a large monorepo with node + typescript + google functions/triggers. When we need to change something, it can sometimes be challenging to pinpoint where the change has impacted, especially for newcomers who may not be familiar with everything happening in the project.
That's why we created this tool to help identify potential impacts of a change.
npm install -g impact_analyzer
# or
yarn add global impact_analyzer
# and after install:
impact_analyzer <dir> <file> <line> --output <type>
you can see more about outputs here: Output Types
function amazingEndpoint() {
return someComplexDataFromDb()
}
function someComplexDataFromDb() {
const data = db.getData()
return someUtilFunc(data)
}
function someUtilFunc(data) {
// modified code snippet here
return {
...data,
id: 'newId',
}
}
To get the impact of the modification within someUtilFunc
, exec this command:
impact_analyzer /Users/myAccount/Desktop/project/src index.ts 11 --output json
# you can export the result for a file that way:
impact_analyzer /Users/myAccount/Desktop/project/src index.ts 11 --output json >> output.json
Sample Output:
{
"name": "someUtilFunc",
"path": "/Users/myAccount/Desktop/project/src",
"relations": [
{
"name": "someComplexDataFromDb",
"path": "/Users/myAccount/Desktop/project/src",
"relations": [
{
"name": "amazingEndpoint",
"path": "/Users/myAccount/Desktop/project/src",
"relations": []
}
]
}
]
}
This output enables comprehensive traversal of all related references, facilitating a thorough understanding of the impact of changes made.
- [x] Find all places that implement a method or a global variable.
- [x] Create a 'binary tree' starting from the change to the head.
- [ ] Create a way to use output templates
- [ ] Create a way to use input templates
- [ ] Create npm package
- [ ] Create an input template to get changes in a git diff
- [ ] Create CLI tool
- [ ] Improve file system to accept windows file system
- [ ] Add rules to exclude directories and files(to exclude test files and this kind of stuffs)
- [ ] Refine to be able to import Parser inside a project
- [ ] Create types
- Sander Verweij and other people who collaborated on dependency-cruiser - an amazing library to validate and visualise dependencies that I got a lot of inspiration to create that project