mysociety / popit

DEPRECATED - Development on PopIt has stopped and it is no longer being maintained
https://goo.gl/Vvej4Q
Other
76 stars 33 forks source link

Cache node_modules during deploy #787

Closed chrismytton closed 9 years ago

chrismytton commented 9 years ago

Now we're using timestamped deploys we want to avoid having to do a full npm install from scratch every time we deploy. This symlinks the node_modules directory into the vhost app directory before doing the npm install so modules are cached between deploys.

struan commented 9 years ago

Small comment but otherwise looks ok.

chrismytton commented 9 years ago

I've changed the post_deploy_actions.bash script to use absolute paths everywhere, so there's no ambiguous paths being used. I've also switched to copying the whole node_modules directory into each release rather than symlinking it because this makes the concept of rolling back to a previous release as simple as switching the symlink to point to an older version.

It also accounts for the (very unlikely) situation where there is a node_module that gets dynamically required at some point during a deploy, which could be missing if it's removed in the newer release.