You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
467 B
23 lines
467 B
10 years ago
|
function runCmd(cmd, args, fn) {
|
||
|
args = args || [];
|
||
|
var runner = require('child_process').spawn(cmd, args, {
|
||
|
// keep color
|
||
|
stdio: "inherit"
|
||
|
});
|
||
|
runner.on('close', function (code) {
|
||
|
if (fn) {
|
||
|
fn(code);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
runCmd('which', ['tnpm'], function (code) {
|
||
|
var npm = 'npm';
|
||
|
if (!code) {
|
||
|
npm = 'tnpm';
|
||
|
}
|
||
|
console.log(npm + ' installing');
|
||
|
runCmd(npm, ['install'], function () {
|
||
|
console.log(npm + ' install end');
|
||
|
});
|
||
|
});
|