ModClean / modclean

Remove unwanted files and directories from your node_modules folder
MIT License
400 stars 15 forks source link

Removed module uglify-save-license #8

Closed yoeran closed 7 years ago

yoeran commented 8 years ago

I ran into a problem running my Gulp scripts after using modclean -n safe. This is because the patterns.json has *license* under the safe patterns. My current Gulp flow however includes uglify and also a module called uglify-save-license.

Now my Gulp task breaks with the error Error: Cannot find module 'uglify-save-license'. Might be a difficult thing to solve since license files never have an extension.

What would you recommend? Should this be in the patterns.json or is it possible to add an exception via the CLI? (haven't found it in the docs).

KyleRoss commented 8 years ago

I'm working on adding a way to ignore certain files per issue #7 but we definitely need to get this fixed as soon as possible. I will be looking into a solution and let you know what I come up with.

DanielSundberg commented 8 years ago

In my project modules "repo validate-npm-package-license" and "history" is removed, which breaks my build.

The most simple solution I can think of is to never remove folders, only files. Don't know what that would do for disk usage though.

KyleRoss commented 8 years ago

@DanielSundberg are you using this via command line or programmatically?

DanielSundberg commented 8 years ago

I'm using command line, seems like this can be tuned using it programmatically? I can understand that using it programmatically is not complicated at all, but I guess most users would have moved on by now and preferred a command line option already built in. And an easy way to see what's going on. Interactive mode is not really an option when the tool is going to remove 5000+ files.

TomSeldon commented 8 years ago

Having similar issues where modules with names containing the word "license" are being removed.

e.g.

Worked around it by not using the CLI and using it programmatically instead, but would be good to see this addressed as part of the CLI.

KyleRoss commented 7 years ago

Sorry for the delay, but I've added a --ignore option that takes a comma-separated list of glob patterns to ignore.

Example: modeclean --ignore="validate-npm-package-license,spdx-license-ids,history"

Hopefully this fixes what you need. I will refactor everything in the future. This has been released to NPM as version 1.3.0