| > I've gotten to where I only install stuff via npm when I'm on a free connection; I normally work on mobile broadband, which is very expensive You could always use this: https://www.npmjs.com/package/npm-proxy-cache It caches the package listings and the packages that you download. It will act as a pass through that with a limited TTL on the cache, but there is an option to fallback to the cache if you can't connect to upstream. Granted, you have to have already installed something for it to work as an offline cache. Also, part of the problem with all those files is that npm allows packages to installed pinned dependency versions. If package-a requires lodash 2.x and package-b requires lodash 3.x, then both will be installed within the respective package's directory. For example let's dive into the node_modules/ in one of my projects. $ ls node_modules/**/lodash.js
node_modules/cordova-lib/node_modules/lodash/chain/lodash.js
node_modules/findup-sync/node_modules/lodash/dist/lodash.js
node_modules/findup-sync/node_modules/lodash/lodash.js
node_modules/globule/node_modules/lodash/dist/lodash.js
node_modules/grunt-contrib-less/node_modules/lodash/dist/lodash.js
node_modules/grunt-contrib-less/node_modules/lodash/lodash.js
node_modules/grunt-contrib-watch/node_modules/lodash/dist/lodash.js
node_modules/grunt-contrib-watch/node_modules/lodash/lodash.js
node_modules/grunt-curl/node_modules/lodash/dist/lodash.js
node_modules/grunt-curl/node_modules/lodash/lodash.js
node_modules/grunt-legacy-log-utils/node_modules/lodash/dist/lodash.js
node_modules/grunt-legacy-log-utils/node_modules/lodash/lodash.js
node_modules/grunt-legacy-log/node_modules/lodash/dist/lodash.js
node_modules/grunt-legacy-log/node_modules/lodash/lodash.js
node_modules/grunt-legacy-util/node_modules/lodash/lodash.js
node_modules/grunt-ng-constant/node_modules/lodash/dist/lodash.js
node_modules/grunt-ng-constant/node_modules/lodash/lodash.js
node_modules/grunt-protractor-runner/node_modules/lodash/lodash.js
node_modules/grunt/node_modules/lodash/lodash.js
node_modules/jshint/node_modules/lodash/chain/lodash.js
node_modules/lodash/chain/lodash.js
node_modules/phantomjs-prebuilt/node_modules/lodash/lodash.js
node_modules/preprocess/node_modules/lodash/lodash.js
node_modules/protractor/node_modules/lodash/lodash.js
That's 24 copies of lodash.js installed that could all be a unique version of lodash used only by said module. |
I'm new to this ecosystem, so I'm definitely not an expert, but it's certainly been an intimidating point for me; maybe the most difficult thing to wrap my head around. I'm used to being able to spelunk into my project, and read everything I'm depending on, or at least skim it and kinda grok where things happen. How would one even do that with 53,000 files? How can anyone trust any application they build with these tools? I mean, the security implications alone are breathtaking, to me.