Nimble Polyglot Microcosm

    npm-helper

    0.0.6 • Public • Published

    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.

    Install

    npm i npm-helper

    DownloadsWeekly Downloads

    7

    Version

    0.0.6

    License

    MIT

    Last publish

    Collaborators

    • pradeepmishra