JamieMason / shrinkpack

Fast, resilient, reproducible builds with npm install.
https://www.npmjs.com/package/shrinkpack
MIT License
793 stars 38 forks source link

Why checking in node_modules doesn't work? #70

Closed nvartolomei closed 8 years ago

nvartolomei commented 8 years ago

Checking in node_modules is horrible (and doesn't work in many cases anyway).

Can you provide examples of this?

My solution is checking in node_modules, ignoring the following patterns and running npm rebuild on checking out.

node_modules/**/*.node
node_modules/**/*.o
node_modules/**/*.a
node_modules/**/*.mk
node_modules/**/*.gypi
node_modules/**/*.target
node_modules/**/.deps/
node_modules/**/build/Makefile
node_modules/**/**/build/Makefile
JamieMason commented 8 years ago

I'm on a train now so please forgive the short reply. I'm referring to the examples in the readme of phantomjs and node-sass where platform binaries are installed. Your workaround is new to me though, does that work for those packages? Thanks for sharing this, it's really helpful.

markerikson commented 8 years ago

The idea is that node_modules is generally going to contain tens of thousands of files, taking up well over 100MB, and quite possibly containing a number of platform-specific build artifacts (ie, libraries that required native code to be compiled during installation). Checking in node_modules in that situation will waste large amounts of space, take a long time, and cause problems if someone needs to check out the repo on another platform.

With Shrinkpack, the platform-agnostic tarballs are checked in instead. Way fewer total files, probably smaller, and because the platform-specific artifacts are built on package install, the repo can be checked out and npm installed on any valid platform.

JamieMason commented 8 years ago

Thanks a lot @markerikson.