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

base-npm

v0.4.1

Published

Base plugin that adds methods for programmatically running npm commands.

Downloads

6,049

Readme

base-npm NPM version NPM downloads Build Status

Base plugin that adds methods for programmatically running npm commands.

You might also be interested in base-bower.

Install

Install with npm:

$ npm install --save base-npm

Usage

Note that if you use base directly you will also need to let the plugin know that it is being registered on a Base "application" (since Base can be used to create anything, like views, collections etc.).

var npm = require('base-npm');
var Base = require('base');
var app = new Base({isApp: true}); // <=
app.use(npm());

// install npm packages `micromatch` and `is-absolute` to devDependencies
app.npm.devDependencies(['micromatch', 'is-absolute'], function(err) {
  if (err) throw err;
});

API

.npm

Execute npm install with the given args, package names and callback.

Params

  • args {String|Array}
  • names {String|Array}
  • cb {Function}: Callback

Example

app.npm('--save', ['isobject'], function(err) {
  if (err) throw err;
});

.npm.install

Install one or more packages. Does not save anything to package.json. Equivalent of npm install foo.

Params

  • names {String|Array}: package names
  • cb {Function}: Callback

Example

app.npm.install('isobject', function(err) {
  if (err) throw err;
});

.npm.latest

(Re-)install and save the latest version of all dependencies and devDependencies currently listed in package.json.

Params

  • cb {Function}: Callback

Example

app.npm.latest(function(err) {
  if (err) throw err;
});

.npm.dependencies

Execute npm install --save with one or more package names. Updates dependencies in package.json.

Params

  • names {String|Array}
  • cb {Function}: Callback

Example

app.npm.dependencies('micromatch', function(err) {
  if (err) throw err;
});

.npm.devDependencies

Execute npm install --save-dev with one or more package names. Updates devDependencies in package.json.

Params

  • names {String|Array}
  • cb {Function}: Callback

Example

app.npm.devDependencies('isobject', function(err) {
  if (err) throw err;
});

.npm.global

Execute npm install --global with one or more package names.

Params

  • names {String|Array}
  • cb {Function}: Callback

Example

app.npm.global('mocha', function(err) {
  if (err) throw err;
});

.npm.exists

Check if one or more names exist on npm.

Params

  • names {String|Array}
  • cb {Function}: Callback
  • returns {Object}: Object of results where the key is the name and the value is true or false.

Example

app.npm.exists('isobject', function(err, results) {
  if (err) throw err;
  console.log(results.isobject);
});
//=> true

History

v0.4.1

  • fixes issue #2 to use the app.cwd when available to ensure npm modules are installed to the correct folder

v0.4.0

  • adds global method for installing with the --global flag
  • adds exists method for checking if a package exists on npm
  • removes base-questions
  • removes askInstall method (moved to base-npm-prompt)

v0.3.0

  • improved instance checks
  • adds base-questions
  • adds dependencies method
  • adds devDependencies method

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.30, on September 11, 2016.