kdesign-ui
Version:
kd is from company of klx, it provide quickly genarator company inner business front structure
33 lines (32 loc) • 1.31 kB
text/typescript
const fs = require('fs')
const path = require('path')
const download = require('download-git-repo')
const ora = require('ora')
const { exec } = require('child_process')
const shell = require('shelljs')
const chalks = require('chalk')
function resolve(dir: string, base = __dirname) {
return path.join(base, dir)
}
module.exports = function (name: string, options: any) {
let cwd:string = process.cwd(), spinner:any
let tplPath: string = `${cwd}/kd-cli-tpl/`
if (!shell.which('git')) {
shell.echo(chalks.red('对不起, 此版本脚手架依赖git工具,请安装git'))
shell.exit(1)
}
spinner = ora(chalks.hex('#55db30').bold('开始下载前端结构基座,请稍等。。。\n由于仓库在github中,可能会较慢,请耐心等待'))
spinner.start()
shell.exec(`git clone https://github.com/460126064/kd-cli-tpl.git`, (err: any) => {
spinner.stop()
if (err) {
console.log(chalks.red('前端结构基座下载失败'))
console.log(`${err}`)
return
}
spinner.stop()
console.log(chalks.hex('#55db30').bold('前端结构基座下载完成!!!,请到kd-cli-tpl目录src下执行 cnpm i 命令下载模块 \n \n PS: 安装模块该功能将在下一版中自动实现,敬请期待'))
shell.exit(0)
})
}