tj / node-prune

Remove unnecessary files from node_modules (.md, .ts, ...)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

assets dist - istanbul reports

pi0 opened this issue · comments

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'

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

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",
}

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

commented

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)
    • This could be done with the addition of a whitelist - ie if a file / directory matches an entry in the whitelist never remove

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 ...

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

commented

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