A Node.JS module, provides an object oriented wrapper for the NPM API. It allow to automatically install modules for Node.js projects.
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 15 commits ahead of eladelrom:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.travis.yml
LICENSE
README.md
package.json

README.md

NPM   Build Status

npm-helper

JavaScript NPM Helper for Node.JS

A Node.JS module, It allow to automatically install modules for Node.js projects from your application.

It has features to look through the node_module files, see the "require" statements, and then list these for your package.json file or other usages.

Installation

Install with the Node.JS package manager npm:

  $ npm install npm-helper

or

Install via git clone:

  $ git clone git://github.com/pradeep-mishra/npm-helper.git

Example

See list of installed modules:

NPM = require('npm-helper');

npm=new NPM();

npm.getInstalledModules(function (data) {
    console.log(data);
});

Create node_modules directory if not present:

NPM = require('npm-helper');

npm=new NPM();

npm.createNodeModulesDirectory();

Get List of dependencies:

NPM = require('npm-helper');

npm=new NPM();

var list=npm.getDependencies();

console.log(list);

Get Attributes of package.json:

NPM = require('npm-helper');

npm=new NPM();

var name=npm.getPackageContent('name');

console.log(name);

Get List of Installed modules:

NPM = require('npm-helper');

npm=new NPM();

npm.getInstalledModules(function(data){
    console.log(data);
});

Install Specific Module:

NPM = require('npm-helper');

npm=new NPM();

npm.createNodeModulesDirectory();

npm.installModule('express', function (err,data) {
    console.log(err,data);
});

Install All modules

NPM = require('npm-helper');

npm=new NPM();

npm.cwd(process.cwd()); // set current working directory for npm (optional).

npm.createNodeModulesDirectory();

npm.exec('install', function (err, data) {
    if (err) {
        throw err;
    }
});

OR

npm.install(function (err, data) {
    if (err) {
        throw err;
    }
});

LICENSE

MIT license. See the LICENSE file for details.