import chalk from "chalk" import _ from "lodash" import rimraf from "rimraf" import * as util from "./util" import buildComponent from "./buildComponent" import buildAll from "./buildAll" import { getOutput, getPath, getPkgs } from "@princess-ui/share" process.cwd = ()=>{ return getPkgs() } console.log(chalk.yellow("正在清除lib文件夹")) rimraf(getOutput("lib"), async err => { if (err) throw err console.log(chalk.green("已清除lib文件夹")) const components = await util.getComponents() for (let i = 0; i < components.length; i++) { const component = components[i] const beginDate = new Date().getTime() console.log(chalk.yellow(`开始构建${component}组件`)) await buildComponent("ps", component, "ps" + _.upperFirst(_.kebabCase(component))) console.log(chalk.green(`构建${component}组件完成, 其耗时:${(new Date().getTime() - beginDate) / 1000}s`)) } const beginDate = new Date().getTime() console.log(chalk.yellow("构建组件结构")) await util.generateComponents(components) console.log(chalk.green("构建组件结构完成")) console.log(chalk.yellow("构建全量包")) await buildAll("ps") console.log(chalk.green(`构建全量包完成, 其耗时:${(new Date().getTime() - beginDate) / 1000}s`)) process.cwd = ()=>{ return getPath() } })