{"size": 621, "ext": "js", "max_stars_repo_path": "src/npm.js", "max_stars_repo_name": "NSFA/ysfkit", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/npm.js", "max_issues_repo_name": "NSFA/ysfkit", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/npm.js", "max_forks_repo_name": "NSFA/ysfkit", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 17.25, "max_line_length": 57, "alphanum_fraction": 0.576489533}
'use strict';
/**
 * npm install package
 *
 * @author:   波比(｡･∀･)ﾉﾞ
 * @date:     2016-11-18  上午9:34
 */

const exec = require('child_process').exec;

let dep = require('../package.json').dependencies;
let depList = Object.keys(dep);

function run(cmd){
	var child = exec(cmd, function (error, stdout, stderr) {
		if (stderr !== null) {
			console.log('' + stderr);
		}
		if (stdout !== null) {
			console.log('' + stdout);
		}
		if (error !== null) {
			console.log('' + error);
		}
	});
}

module.exports = function(deps){
	if(deps){
		run('npm install '+deps);
	}else{
		run('cnpm install '+depList.join(' '));
	}

}
