npm dedupe
can flatten the folder structure. However, before doing that. I hope to see a list of duplicate packages, so that I know whether or not to go forward. Is there such a feature? If not, is there some sort of scripts that help me achieve this?
Try this:
npm ls --parseable | xargs -L1 sh -c 'basename $1' dummy | sort | uniq -c | grep -v "^ *1 " | sort -rn
The pipeline here is: