Using CLI arguments
Code example
What does process.argv
have?
Well, try doing console.log(process.argv);
dude.
Example code:
//var checkpackage = require('../../../checkpackage/index.js');
checkpackage = require('checkpackage');
var name = process.argv.slice(2)[0];
console.log('Searching ...')
if (name)
checkpackage(name);
else
console.log('Kindly enter an package name');
package.json
{
"name": "example1",
"version": "1.0.0",
"description": "testing",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "amit",
"license": "ISC"
}