Closed nicoespeon closed 3 years ago
You're absolutely right, I've already started to migrate the path resolving in this direction. Will try to come up with a more robust path resolving in the following days that works exactly that way.
@nicoespeon Just pushed the bugfix version 0.14.1, which should hopefully (mostly) fix the duplicate issues by using relative analysis/project paths as a base for file results and parsed dependencies. Need to test and maybe optimize that further in the coming days.
Awesome news @glato π
I'll test that this week and get back to you with results.
It looks better indeed! But I still find some remaining duplication:
The structure is the following:
app/
|__ pages/
| |__ purchase.js # imports "../components/purchase/detailed-logs"
|
|__ components/
|__ purchase/
|__ simple-logs.js # imports "./detailed-logs"
|__ detailed-logs.js
Somehow, one of them results in app/components/purchase/detailed-logs.js
and the other in ../components/purchase/detailed-logs
.
Do you need help to debug this one?
Thatβs interesting. Iβll try to create a unit test based on this setup, to better debug and solve this case. Iβll get back to you @nicoespeon, thanks for the report π
@nicoespeon Your structure example was very helpful, I've constructed the same and hopefully found the bug. It looks promising so far:
I'll test this with more path cases tomorrow and on bigger examples.
Glad it was helpful! Improving the parser, one test at a time 𧱠π
@nicoespeon I've updated the (dependency) path resolving for TS and JS in the new version 0.15.1. This includes some smaller refactorings that allows to better unit test some path resolving methods. I've tested this with the source repos of Angular and React, seems to be promising so far. Would be great if you find some time to re-test this with version 0.15.1 and report back if this solved the problems?
Did another try today and that worked wonderfully!
Great job you did here π
I'll experiment around, see if the graph is overall correct (this one is a reasonable-sized project I can grasp with my brain). Then I'll also experiment on a much bigger project I can't grasp.
I'll let you know if I find issues. If I can, I'll attempt to fix them too π In the meantime, this issue looks fixed to me. Thank you!
@glato I just found a file that was a solo-node, floating around. Turns out this is a dead code that's not imported anywhere π―
Thank you for this quick win I got here!
I noticed something while generating graphs for JS projects I'm working with:
These 2 files are the same, but they are imported from 2 distinct files relatively:![image](https://user-images.githubusercontent.com/1094774/109437639-dd323100-79f3-11eb-879f-23d7c74b8ccc.png)
I think a solution would be to resolve the path of imported files relative to the root of the project. What do you think? Is there a similar problem in other languages or is it specific to the JS parser?