Comparing version 0.0.1 to 0.0.2
12
npmi.js
@@ -14,3 +14,3 @@ var npm = require('npm'); | ||
*/ | ||
var npmInstaller = function (options, callback) { | ||
var npmi = function (options, callback) { | ||
var name = options.name, | ||
@@ -91,7 +91,7 @@ version = options.version || 'latest', | ||
npmInstaller.LOAD_ERR = LOAD_ERR; | ||
npmInstaller.INSTALL_ERR = INSTALL_ERR; | ||
npmInstaller.LIST_ERR = LIST_ERR; | ||
npmInstaller.VIEW_ERR = VIEW_ERR; | ||
npmi.LOAD_ERR = LOAD_ERR; | ||
npmi.INSTALL_ERR = INSTALL_ERR; | ||
npmi.LIST_ERR = LIST_ERR; | ||
npmi.VIEW_ERR = VIEW_ERR; | ||
module.exports = npmInstaller; | ||
module.exports = npmi; |
{ | ||
"name": "npmi", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Gives a simplier API to npm install (programatically installs stuffs)", | ||
@@ -5,0 +5,0 @@ "main": "npmi.js", |
@@ -5,1 +5,33 @@ npmi | ||
NodeJS package that gives a simplier API to npm install (programatically installs things) | ||
### Installation | ||
```sh | ||
npm install npmi | ||
``` | ||
### Usage | ||
```js | ||
var npmi = require('./../npmi'); | ||
var path = require('path'); | ||
var options = { | ||
name: 'your-module', // your module name | ||
version: '0.0.1', // expected version [default: 'latest'] | ||
path: '.', // installation path [default: '.'] | ||
forceInstall: false, // force install if set to true (even if already installed, it will do a reinstall) [default: false] | ||
npmLoad: { // npm.load(options, callback): this is the "options" given to npm.load() | ||
loglevel: 'silent' // [default: {loglevel: 'silent'}] | ||
} | ||
}; | ||
npmi(options, function (err, result) { | ||
if (err) { | ||
if (err.code === npmi.LOAD_ERR) console.log('npm load error'); | ||
else if (err.code === npmi.INSTALL_ERR) console.log('npm install error'); | ||
return console.log(err.message); | ||
} | ||
// installed | ||
console.log(options.name+'@'+options.version+' installed successfully in '+path.resolve(options.path)); | ||
}); | ||
``` |
@@ -1,2 +0,2 @@ | ||
var npmInstaller = require('./../npm-installer'); | ||
var npmi = require('./../npmi'); | ||
var path = require('path'); | ||
@@ -11,6 +11,6 @@ | ||
}; | ||
npmInstaller(options, function (err, result) { | ||
npmi(options, function (err, result) { | ||
if (err) { | ||
if (err.code === npmInstaller.LOAD_ERR) console.log('npm load error'); | ||
else if (err.code === npmInstaller.INSTALL_ERR) console.log('npm install error'); | ||
if (err.code === npmi.LOAD_ERR) console.log('npm load error'); | ||
else if (err.code === npmi.INSTALL_ERR) console.log('npm install error'); | ||
return console.log(err.message); | ||
@@ -17,0 +17,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6105
37