ant-design/scripts/install.js
2016-04-14 11:39:02 +08:00

24 lines
452 B
JavaScript

function runCmd(cmd, args, fn) {
args = args || [];
const runner = require('child_process').spawn(cmd, args, {
// keep color
stdio: 'inherit'
});
runner.on('close', (code) => {
if (fn) {
fn(code);
}
});
}
runCmd('which', ['tnpm'], (code) => {
let npm = 'npm';
if (!code) {
npm = 'tnpm';
}
console.log(`${npm} installing`);
runCmd(npm, ['install'], () => {
console.log(`${npm} install end`);
});
});