uino-kiss-cli
Version:
uino-kiss-cli 用来初始化项目的方便工具
25 lines (21 loc) • 717 B
JavaScript
const path = require('path');
const { exec, spawn } = require('child_process');
const isWin32 = process.platform === 'win32';
const log = console.log;
const chalk = require('chalk');
module.exports = () => {
const startTime = Date.now()
const basePath = __dirname.replace(/libs$/, '');
const cli = `${basePath}node_modules/.bin/conventional-changelog`;
const args = [cli, '-p ', 'angular', '-i', 'CHANGELOG.md', '-s'];
const dirPath = process.cwd();
const bin = isWin32 ? 'node.cmd' : 'node';
const npmInstall = spawn(bin, args, {
cwd: dirPath,
stdio: 'inherit',
});
npmInstall.on('close', (code) => {
const s = Date.now() - startTime
log('✨ '+chalk.green(`完成,耗时 ${s}ms`));
});
};