Closed jorrit closed 6 years ago
@jorrit Since the newer versions of NPM already flattens the module structure (unless there is a version conflict), I'm not sure if your suggestion is going to fix the issue entirely. I may adjust the patterns to be a bit more specific to prevent the issue from happening.
An update will be coming hopefully today.
My suggestion was not dependent on node_modules being flat or not. I meant to suggest that no directory directly below any node_modules folder should not be removed.
Let's say the directory structure is something like this:
node_modules
node_modules/history
node_modules/something
node_modules/something/history.md
node_modules/something/node_modules
node_modules/something/node_modules/history
Both history folders would be kept but history.md would be deleted.
@jorrit Good point, still need to investigate this further. I believe the idea of having patterns that are different between directories and folders will help alleviate this situation going forward. It's something I'm going to look into building very soon.
modclean removes the well-known history package. This problem is similar to the one @phips28 encountered in ModClean/modclean-patterns-default#1.
My suggestion is to not delete (unless empty) directories that are children of a
node_modules
directory. This catches all situations in which a package matches a pattern.