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

npm-fast-install

v0.1.1

Published

Installs and caches npm modules

Downloads

4

Readme

npm-fast-install

Installs and caches npm modules so that subsequent installs are super fast, especially if native C++ addons are being compiled.

NPM version

NPM

npm-fast-install will read in the specified project directory's package.json, then for each dependency, installs that dependency into a temp directory. During the install process, C++ addons will be compiled. Next the installed files will be moved to the npm-fast-install cache directory (defaults to ~/.npm-fast-install). Finally the cached package will be copied into the project directory's node_modules directory.

It's important to note that every package is cached by its version + Node.js architecture + Node.js module API version. Since packages can have dependencies that are native C++ addon packages, every package is cached by these criteria. This means that if you install [email protected] using Node.js 0.12 and 4.1, there will be 2 copies of [email protected] in the cache.

Similarly if your project has a dependency on packages foo and bar and each of those have a dependency on [email protected], lodash will be installed twice: one in foo/node_modules/lodash and one on bar/node_modules/lodash.

Basically, npm-fast-install is more about speed of subsequent npm installs than saving hard drive space.

How fast? On a MacBook Pro, the initial install of ejs, titanium, jade, npm, mongo, node-ios-device, ws, and zombie took around 25 seconds. Subsequent installs took around 3 seconds. Boom!

Installation

From npm:

npm install -g npm-fast-install

From GitHub:

npm install git://github.com/appcelerator/npm-fast-install.git

CLI Usage

npm-fast-install [project-dir] [options]

The project-dir is optional. It defaults to the current directory.

options

-h, --help             output usage information
-v, --version          output the version number
-a, --all              Installs all module deps; by default only installs production deps
-c, --cache-dir [dir]  Cache directory; defaults to "~/.npm-fast-install"
--allow-shrinkwrap     Force disable shrinkwrap; defaults to false
-j, --json             Outputs results as JSON

API

install(options)

Installs and caches all packages defined in the project directory's package.json.

Arguments

  • options - An object with various settings. All options are optional.

    • dependencies (object) - override the dependencies from package.json.
    • allowShrinkwrap (boolean) - When true, tells npm to honor shrinkwrap settings. Defaults to false.
    • cacheDir (string) - The directory to cache modules. Defaults to ~/.npm-fast-install.
    • dir (string) - The directory containing the package.json. Defaults to process.cwd().
    • logger (object) - A logger to use. Defaults to console.
    • maxTasks (number) - The maximum number of npm install jobs to run simultaneously. Defaults to 5.
    • production (boolean) - When true, installs only dependencies, not dev dependencies. Defaults to true.

Returns

  • Promise - A promise object

Example

var nfi = require('npm-fast-install');

nfi.install({
		cacheDir: '/tmp/npm-fast-install-cache',
		dir: '/path/to/project',
		allowShrinkwrap: false,
		logger: console,
		production: true
	})
	.then(function (results) {
		console.info('It worked!');
		Object.keys(results.modules).forEach(function (name) {
			console.info('%s@%s %s', name, results.modules[name].version, results.modules[name].path);
		});
	})
	.catch(function (err) {
		console.error('Oh no!');
		console.error(err);
		process.exit(1);
	});

License

Copyright (c) 2015 by Appcelerator, Inc. All Rights Reserved. This project is licensed under the Apache Public License, version 2. Please see details in the LICENSE file.