mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 09:49:57 +08:00
23 lines
467 B
JavaScript
23 lines
467 B
JavaScript
|
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');
|
||
|
});
|
||
|
});
|