npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dashlane/dep-cache

v0.10.7

Published

cache dependency manager installs to local machine - fork of npm-cache by swaraj - respects commandline args and deals with npm --production args etc.

Downloads

24

Readme

dep-cache

this dep-cache is a fork of npm-cache from swarajban

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

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

How it Works

When you run dep-cache install [npm|bower|jspm|composer|yarn], it first looks for package.json, bower.json, composer.json, yarn.lock, etc. 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, dep-cache uses the system's installed dependency manager to install the dependencies. Once the dependencies are installed, dep-cache tars the newly downloaded dependencies and stores them in the cache directory. The next time dep-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.

Upon installing cached dependencies, for npm & yarn, it launches "npm run prepublish" for npm <= 4 (starting npm 5, npm stop launching npm run prepublish upon npm install - to be followed up for yarn)

Advanced features

No archive

When storing the newly dependencies installed, dep-cache can perform a simple copy from the current project to the cache directory instead of creating a tar.gz

symbolic link

Used with the no archive feature, this feature provide the fastest npm install possible. When the dependencies have already been cached, it just creates a symbolic link from the current directory to the cached dependencies. For big project, copying all the dependencies from the cached folder, or unTARing the TARed dependencies can be time consuming

A reverse symbolic link can be created from the cached dependency folder to the current folder to mimic exactly the configuration of a normal npm install

Args flowthrough

Curtesy of Klaus Hougesen, dep-cache supports arg flowthrough and takes args into account when calculating hashes Hash is created by globbing devdependencies, dependencies and installOptions. This can also be used to create environment specific hash tarballs on a build server. For instance dep-cache install npm --production --bserver01 would create a different hash tarball than dep-cache install npm --production --bserver02

Installation

npm install -g dep-cache

Usage

dep-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:

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

Examples

   dep-cache install    # try to install npm, bower, and composer components
   dep-cache install bower  # install only bower components
   dep-cache install bower npm  # install bower and npm components
   dep-cache install --cleanOldCachedDepsSince 3 npm  # clean cached dependency not used since 3 days and then install npm components
   dep-cache install --cacheDirectory /home/cache/ bower    # install components using /home/cache as cache directory
   dep-cache install --forceRefresh  bower  # force installing dependencies from package manager without cache
   dep-cache install --noArchive npm    # do not compress/archive the cached dependencies
   dep-cache install --useSymlink yarn # do not compress the cached dependencies, and when installing dependencies from cache, create a symlink instead of copying files
   dep-cache install npm --production -msvs_version=2013    # add args to npm installer
   dep-cache install npm --production -msvs_version=2013 bower --silent # add args to npm installer and bower
   dep-cache clean  # cleans out all cached files in cache directory
   dep-cache clean --cleanOldCachedDepsSince 3 # cleans cached files in cache directory that are older than 3 days
   dep-cache hash   # reports the current working hash

Contributing

Feel free to contribute and to submit PRs @ https://github.com/Dashlane/npm-cache