Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: List roots #116

Closed
AlbinTheander opened this issue Apr 2, 2017 · 8 comments
Closed

Feature request: List roots #116

AlbinTheander opened this issue Apr 2, 2017 · 8 comments

Comments

@AlbinTheander
Copy link

One thing I use my dependency tree for is to find the roots, the packages that no-one is depending upon. Mostly to find stray files that are no longer used in larger projects.

It would be neat if Madge could list the roots directly from the command line.

@pahen
Copy link
Owner

pahen commented Apr 18, 2017

You can always achieve that with some help from grep like this madge --summary src/app | grep '^0'. But I agree that it would be nice to maybe have an option for it.

@pahen
Copy link
Owner

pahen commented Apr 18, 2017

Sorry, that didn't solve your problem at all. I suppose we need to add such feature. I'll look into adding a new option called --orphans to list all modules that no-one is depending on.

@AlbinTheander
Copy link
Author

Sounds great. Thanks for the response!

@mrjoelkemp
Copy link
Contributor

@pahen Do you think that this makes sense to be a part of dependency-tree proper? Even the sniff for circular dependencies or any other non-visualization operations on the dependency tree seem outside of the scope of madge.

A while back, I was thinking about a 6.0 version of dependency tree that exported a class instead of a pure function. This way, it could have all of the methods (find orphans, find dependents, etc) that leverage the generated tree. Madge would use it via the toJSON method or generate the graphviz nodes during the tree generation process (possibly a perf gain for large trees to avoid a second pass).

I don't have strong opinions on this, so I'm fine either way; just seeing an opportunity (similar to the extraction of the tree generation logic) to avoid muddying the semantics of madge. Thoughts?

@pahen
Copy link
Owner

pahen commented Apr 23, 2017

@mrjoelkemp I would love to move out such features in the long term from madge to dependency-tree. But since this is such a small feature I'll add it to madge for now. But let's pick up this ball on a later point :)

@mrjoelkemp
Copy link
Contributor

Sounds good!

@pahen
Copy link
Owner

pahen commented Jul 15, 2017

Added --orphans in v2.0.0 now @AlbinTheander :)

@AlbinTheander
Copy link
Author

Sounds great. I'll give it a try as soon as possible.

Thanks for all the great work!! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants