Base plugin that adds methods for programmatically running npm commands.
npm install base-npmBase plugin that adds methods for programmatically running npm commands.
You might also be interested in base-bower.
Install with npm:
``sh`
$ npm install --save base-npm
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.).
`js
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;
});
Execute npm install with the given args, package names and callback.
Params
* args {String|Array}names
* {String|Array}cb
* {Function}: Callback
Example
`js`
app.npm('--save', ['isobject'], function(err) {
if (err) throw err;
});
Install one or more packages. Does not save anything to package.json. Equivalent of npm install foo.
Params
* names {String|Array}: package namescb
* {Function}: Callback
Example
`js`
app.npm.install('isobject', function(err) {
if (err) throw err;
});
(Re-)install and save the latest version of all dependencies and devDependencies currently listed in package.json.
Params
* cb {Function}: Callback
Example
`js`
app.npm.latest(function(err) {
if (err) throw err;
});
Execute npm install --save with one or more package names. Updates dependencies in package.json.
Params
* names {String|Array}cb
* {Function}: Callback
Example
`js`
app.npm.dependencies('micromatch', function(err) {
if (err) throw err;
});
Execute npm install --save-dev with one or more package names. Updates devDependencies in package.json.
Params
* names {String|Array}cb
* {Function}: Callback
Example
`js`
app.npm.devDependencies('isobject', function(err) {
if (err) throw err;
});
Execute npm install --global with one or more package names.
Params
* names {String|Array}cb
* {Function}: Callback
Example
`js`
app.npm.global('mocha', function(err) {
if (err) throw err;
});
Check if one or more names exist on npm.
Params
* names {String|Array}cb
* {Function}: Callbackreturns
* {Object}: Object of results where the key is the name and the value is true or false.
Example
`js`
app.npm.exists('isobject', function(err, results) {
if (err) throw err;
console.log(results.isobject);
});
//=> true
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 flagexists
* adds method for checking if a package exists on npmaskInstall
* removes base-questions
* removes method (moved to base-npm-prompt)
v0.3.0
* improved instance checks
* adds base-questions
* adds dependencies methoddevDependencies
* adds method
* base-questions: Plugin for base-methods that adds methods for prompting the user and storing the answers on… more | homepage
* base-task: base plugin that provides a very thin wrapper around https://github.com/doowb/composer for adding task methods to… more | for adding task methods to your application."" class="text-primary hover:underline" target="_blank" rel="noopener noreferrer">homepage
* base: base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… more | set, get, del and use."" class="text-primary hover:underline" target="_blank" rel="noopener noreferrer">homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
_(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:
`sh`
$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
`sh``
$ npm install -d && npm test
Jon Schlinkert
* github/jonschlinkert
* twitter/jonschlinkert
Copyright © 2016, Jon Schlinkert.
Released under the MIT license.
*
_This file was generated by verb-generate-readme, v0.1.30, on September 11, 2016._