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…
Show HN: Node.js node_modules file pruning
11–20 of 66 posts
Re: Show HN: Node.js node_modules file pruning
#12Doesn't this also result in .d.ts files being removed? These are type declaration files (Kinda like C's .h files) that provide types for you without the file size overhead of the full TypeScript source.
Re: Show HN: Node.js node_modules file pruning
#13This 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
Re: Show HN: Node.js node_modules file pruning
#14The caveats is that this won’t work 100% of the time. There will be a dependency deep down in the tree that needs to read a markdown file from the file system or something of that sort. These issues could be hard to debug if this tool doesn’t provide good visibility into what’s being deleted.
Re: Show HN: Node.js node_modules file pruning
#15I ported it to bash really quick, as thats probably easier for people to drop into their dotfiles if they don't have a Golang env setup.
https://gist.github.com/gpittarelli/64d1e9b7c1a4af762ec467b1...
If we all just do our part and send a PR setting up .npmignore for one or two of these projects, maybe we won't need this anymore
Re: Show HN: Node.js node_modules file pruning
#16Shouldn't this be handled entirely by npm? If these files are unnecessary why do they get downloaded in the first place?
What gave you a reason to believe npm was well-architected?
Furthermore, it would be quite irritating if it started assuming specific file extensions are forbidden instead of using the explicit list provided by the author.
Re: Show HN: Node.js node_modules file pruning
#17Nice job TJ. This definitely scratches an itch. Thought you were a Go dev these days. ;)
Re: Show HN: Node.js node_modules file pruning
#18Shouldn'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
#19Re: Show HN: Node.js node_modules file pruning
#20Glad to see more of his work!
Edit: It's Go lol.