node_modules
folder within a given build will never be re-used What is the recommended way to centralize / re-use the node_modules
folder between builds given our stack?
npm cache
-- This happens by default, so at least it's not like we're downloading packages from the internet every time. node_modules
to a common directory -- This approach worked (went from minutes to seconds) but unfortunately some gulp/grunt tasks fail when dealing with symlinks on Windows. Womp womp.node_modules
folder further up the hierarchy: Not sure, but it seems like node may hierarchically search for the node_modules
folder. In that case, creating a node_modules
folder in a parent directory may solve the issue.NODE_PATH
environment variable -- Not sure if setting this will do something different similar to the point above and provide a common node_modules
folder when one is not found in one of our builds.Move-Item
back & forth between a backup directory: If we have to hack it, it might be worth it to use a backup directory per project ID and use Move-Item
, which should update partition links rather than copying files, at least. That approach is outlined on this blog post. What you have been doing is the best practice in the industry. I dont know if u can make it any better with npm.
have u tried yarn instead https://github.com/yarnpkg/yarn there is a way to use along with docker too https://hackernoon.com/using-yarn-with-docker-c116ad289d56#.8bhk0tkz4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With