|
@ -1,6 +1,7 @@ |
|
|
import chalk from "chalk" |
|
|
import chalk from "chalk" |
|
|
import _ from "lodash" |
|
|
import _ from "lodash" |
|
|
import rimraf from "rimraf" |
|
|
import rimraf from "rimraf" |
|
|
|
|
|
import fs from "fs-extra" |
|
|
import * as util from "./util" |
|
|
import * as util from "./util" |
|
|
|
|
|
|
|
|
import buildComponent from "./buildComponent" |
|
|
import buildComponent from "./buildComponent" |
|
@ -37,16 +38,20 @@ rimraf(getOutput("lib"), async err => { |
|
|
console.log(chalk.green(`构建全量包完成, 其耗时:${(new Date().getTime() - beginDate) / 1000}s`)) |
|
|
console.log(chalk.green(`构建全量包完成, 其耗时:${(new Date().getTime() - beginDate) / 1000}s`)) |
|
|
|
|
|
|
|
|
console.log(chalk.red("构建完成,开始生成d.ts")) |
|
|
console.log(chalk.red("构建完成,开始生成d.ts")) |
|
|
const dtsOptions = { |
|
|
// const dtsOptions = {
|
|
|
name: pkg.name, |
|
|
// name: pkg.name,
|
|
|
main: `princess-ui/lib/packages/all.d.ts`, |
|
|
// main: `princess-ui/lib/packages/all.d.ts`,
|
|
|
out: `../index.d.ts`, |
|
|
// out: `../index.d.ts`,
|
|
|
outputAsModuleFolder: true |
|
|
// outputAsModuleFolder: true
|
|
|
} |
|
|
// }
|
|
|
dts.bundle(dtsOptions) |
|
|
// dts.bundle(dtsOptions)
|
|
|
console.log(chalk.red("生成完毕,开始清理残余")) |
|
|
// console.log(chalk.red("生成完毕,开始清理残余"))
|
|
|
|
|
|
fs.moveSync(getOutput("lib/packages/components/components.d.ts"), getOutput("lib/components.d.ts"), { overwrite: true }) |
|
|
|
|
|
fs.moveSync(getOutput("lib/packages/hooks"), getOutput("lib/hooks"), { overwrite: true }) |
|
|
|
|
|
fs.moveSync(getOutput("lib/packages/all.d.ts"), getOutput("lib/index.d.ts"), { overwrite: true }) |
|
|
rimraf.sync(getOutput('lib/packages')) |
|
|
rimraf.sync(getOutput('lib/packages')) |
|
|
console.log(chalk.green("残余清理完毕")) |
|
|
// console.log(chalk.green("残余清理完毕"))
|
|
|
|
|
|
console.log(chalk.green("d.ts生成完毕")) |
|
|
process.cwd = oldCwdFn |
|
|
process.cwd = oldCwdFn |
|
|
console.log(chalk.yellow(`工作目录重置为:${process.cwd()}`)) |
|
|
console.log(chalk.yellow(`工作目录重置为:${process.cwd()}`)) |
|
|
}) |
|
|
}) |
|
|