mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
24 lines
452 B
JavaScript
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`);
|
|
});
|
|
});
|