GithubHelp home page GithubHelp logo

steffandonal / npm-cache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from swarajban/npm-cache

0.0 2.0 0.0 289 KB

Cache (npm | bower | composer | jspm) installs

License: MIT License

JavaScript 100.00%

npm-cache's Introduction

npm-cache

npm-cache is a command line utility that caches dependencies installed via npm, bower, jspm and composer.

It is useful for build processes that run [npm|bower|composer|jspm] install every time as part of their build process. Since dependencies don't change often, this often means slower build times. npm-cache helps alleviate this problem by caching previously installed dependencies on the build machine. npm-cache can be a drop-in replacement for any build script that runs [npm|bower|composer|jspm] install.

How it Works

When you run npm-cache install [npm|bower|jspm|composer], it first looks for package.json, bower.json, or composer.json in the current working directory depending on which dependency manager is requested. It then calculates the MD5 hash of the configuration file and looks for a filed named .tar.gz in the cache directory ($HOME/.package_cache by default). If the file does not exist, npm-cache uses the system's installed dependency manager to install the dependencies. Once the dependencies are installed, npm-cache tars the newly downloaded dependencies and stores them in the cache directory. The next time npm-cache runs and sees the same config file, it will find the tarball in the cache directory and untar the dependencies in the current working directory.

Installation

npm install -g npm-cache

Usage

npm-cache install

To specify arguments to each dependency manager, add the arguments after listing the dependency manager.

For example, to install bower components with the --allow-root option, and composer with the --dry-run option:

npm-cache install bower --allow-root composer --dry-run

Examples

npm-cache install	# try to install npm, bower, and composer components
npm-cache install bower	# install only bower components
npm-cache install bower npm	# install bower and npm components
npm-cache install bower --allow-root composer --dry-run	# install bower with allow-root, and composer with --dry-run
npm-cache install --cacheDirectory /home/cache/  bower 	# install components using /home/cache as cache directory
npm-cache install --forceRefresh  bower	# force installing dependencies from package manager without cache
npm-cache clean	# cleans out all cached files in cache directory

Contributing

Though I have a busy day job, I will do my best to add simple feature requests and merge PRs as soon as I can. I know this package is not following many of today's best practices (namely TESTS, a proper branching strategy, and more), but I hope you still find it useful.

Important: Please submit all pull requests to the branch feature/pull-requests

Analytics

npm-cache's People

Contributors

swarajban avatar sod avatar minichate avatar jvdanilo avatar eher avatar boatmeme avatar fracmak avatar steffandonal avatar toolmantim avatar nordyke avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.