tj/node-prune

Feature request: keep certain directories

tomjakubowski opened this issue · 3 comments

Some NPM modules actually include Javascript modules named docs/..., and node-prune breaks these because docs/ are removed per the default rules. It would be nice, then, to mark a given directory to not be removed according to node-prune's rules:

$ node-prune --except node_modules/googleapis/../docs/

Has there been any consideration to implement this feature? I would also appreciate it. In case of Ezra Project, I needed to remove one entry from the list of directories pruned. And for this simple patch I had to fork node-prune.

I just noticed that a new release has actually been tagged in May this year, mentioning --include and --exclude flags. This is not mentioned in the README file, though. Is there a reason why no release is available?

I wrote clean-modules to get around this, it's about as fast as node-prune and supports proper globbing by file paths.

To achieve the question from the OP you can e.g. do:

clean-modules --exclude **/googleapis/**/docs

--include and --exclude works for node-prune, but it only seems to validate the globs against file names.