Hey, Probably a somewhat n00b question, but on sites of your size that build and release as often as yours do - how do you manage your npm and bower packages? Currently we .gitignore our node_modules and bower_components directories, but I feel we should break that SPOF we have with npm and bower's servers, in the event they're unavailable when our CI is running a build/release.
I had considered checking the packages into git, but;
- I'm sure this is frequently advised against [citation needed].
- Some packages such as karma-runner/karma-phantomjs-launcher perform a tailored installation for the OS
npm install
was run from (egphantomjs
for Windows if installed when on Windows) - so if developer A on Windows runsnpm install
and checks it into git, CI Server B on Linux will be failing builds.
Is this SPOF something you're even concerned about? And if so, how do you manage it please?
Thanks a lot guys appreciate it.
Jamie.
There's a couple of ways I've used to deal with this, neither are particularly better than the other:
Check in node modules
node_modules
to gitnpm dedupde
to save some duplicationnpm rebuild
on CI to ensure you have the right build for native modulesThis makes it easy to see when things change, but at the cost of noisy diffs with loads of "generated" files in your repo
Run a simple npm mirror
.gitignore
node_modules
package.json
is checked innpm shrinkwrap
after package changes and check innpm-shinkwrap.json
npm_config_regsitry=
environment variable to nopar URL on CInpm install
on CIThis avoids the noisy git stuff, but means you need to keep the mirror up and running for builds.
It has the added advantage of being able to host private packages.