tj / node-prune

Remove unnecessary files from node_modules (.md, .ts, ...)
MIT License
4.4k stars 130 forks source link

assets dist - istanbul reports #50

Open pi0 opened 6 years ago

pi0 commented 6 years ago

Hi. Thanks for this awesome tool. While I've tested it against many projects, the most common problematic thing is assets directory which is usually intended to be included in dist.

Istanbul reports is an example:

ERROR: Error: ENOENT: no such file or directory, scandir '/usr/src/app/node_modules/istanbul-reports/lib/html/assets'

chinanf-boy commented 6 years ago

i got that thing too, -.- assets seem like necessary

chinanf-boy commented 6 years ago

The assets/ will be del

https://github.com/tj/node-prune/blob/master/prune.go#L81

// DefaultDirectories pruned.
//
// Copied from yarn (mostly).
var DefaultDirectories = []string{
    "__tests__",
    "test",
    "tests",
    "powered-test",
    "docs",
    "doc",
    ".idea",
    ".vscode",
    "website",
    "images",
    "assets",
    "example",
    "examples",
    "coverage",
    ".nyc_output",
    ".circleci",
    ".github",
}
pi0 commented 6 years ago

/cc @tj What's your idea rethinking about assets dir?

prgp commented 5 years ago

Am wanting to use node-prune because it is really helpful, but finding the lack of configuration rather limiting as I need to generate coverage reports (istanbul-reports html), but I can't because they are broken by the removal of assets directory by node-prune.

It would be really useful if:

1) We could have a 'verbose' mode where we see exactly what was removed (maybe even a 'dry-run' mode to see what would be deleted) 2) Some way of specifying a configuration file that would allow us to either explicitly configure what is deleted or not (like .yarnclean which allow us to specify !istanbul-reports/lib/html/assets to specify not to delete this directory)

NB There is currently a 'verbose' flag that seems to do nothing - would be helpful if it detailed what work was being / would be done ...

ledniy commented 4 years ago

Did anyone solved it with --exclude? For me seems like it's not working for excluding folder

ginkcode commented 3 years ago

I'm using exclude and it works well. Notice that it's -exclude not --exclude.