8000 GitHub - ziluvatar/npm-preserve
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ziluvatar/npm-preserve

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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-preserve

Usage

#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
# deploy

How 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/bar

License

MIT 2016 - José F. Romaniello

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%
0