npm-preserve
v2.0.0
Published
Speed up your npm install operations by caching locally the result.
Downloads
21
Readme
Speed up your npm install operations by caching locally the result.
NPM already has a cache but it will rebuild stuff after is copied from cache.
Install
npm i -g jfromaniello/npm-preserveUsage
#restore or install from scratch
npm-preserve-restore || npm install
# npm test ..etc
#cache the stuff after you are done
npm-preserve-cache
# npm prune --production
# deployHow it works
npm-preserve-cache computes an md5 hashsum of package.json's devDepdencies and dependencies plus all the content npm-shrinkwrap. Then it stores the node_modules directory in the current dir as /tmp/project-name-HASHSUM.tar.gz.
npm-preserve-restore computes an md5 hashsum of package.json's devDepdencies and dependencies plus all the content npm-shrinkwrap. Then it search the tar.gz file named /tmp/project-name-HASHSUM.tar.gz if this file exists, it will restore node_modules from this file and exit with status code 0, if it doesn't exists it will return code 1.
project-name in the file name is the name of the package.json in the current directory.
npm-preserve-cache and npm-preserve-restore uses /tmp as default caching directory, you could also use a different directory with:
npm-preserve-cache /foo/bar
npm-preserve-restore /foo/barLicense
MIT 2016 - José F. Romaniello
