Live data from Hacker News

Show HN: Node.js node_modules file pruning

github.com

1–10 of 66 posts

Re: Show HN: Node.js node_modules file pruning

#2
Rather than two giant 440px high images consisting of tiny text in the readme I'd quite love to read exactly what it does and why. Does it prune files in modules that are not needed? If so what heuristics does it use to prune files? Or does it prune modules that are not needed?

Reading the code[1] it appears to delete directories and extensions based on a blacklist.

1. https://github.com/tj/node-prune/blob/master/prune.go#L15-L5...

Re: Show HN: Node.js node_modules file pruning

#3
post #2

Rather than two giant 440px high images consisting of tiny text in the readme I'd quite love to read exactly what it does and why. Does it prune files in modules that are not needed? If so what heuristics does it use to prune files? Or does it prune modules that are not needed? Reading the code[1] it appears to delete directories and extensions based on a blacklist. 1. https://github.com/tj/node-prune/blob/master/pru…

It looks like it removes the files necessary for "npm install" assuming that the module will do npm install immediately when you install it. This is not true for all cases though..which is why the files should be kept around. Disk space is cheap. This isn't bad for deployments though.

Re: Show HN: Node.js node_modules file pruning

#6

Shouldn't this be handled entirely by npm? If these files are unnecessary why do they get downloaded in the first place?

Ideally people use the "files" array. It might be nice if someone writes a bot to go around and fix large packages by adding that.

Re: Show HN: Node.js node_modules file pruning

#9
This is completely useless because npm still downloads those files and the hdd space is pretty negligeble. It should def go under the category of troll driven development. This might be useful for docker images that will be distrubuted and will be downloaded a lot, but even there it's a stretch.

That being said, it would be great if npm had some functionality around packaging only the necessary files for actually running the module and removing all unnecessary files (tests, source code, documentation) and have an opt-in option to install those.

Re: Show HN: Node.js node_modules file pruning

#10

This is completely useless because npm still downloads those files and the hdd space is pretty negligeble. It should def go under the category of troll driven development. This might be useful for docker images that will be distrubuted and will be downloaded a lot, but even there it's a stretch. That being said, it would be great if npm had some functionality around packaging only the necessary files for actually run…

It's for Lambda
Post reply on HN