fix(build): improve code style (#528)

This commit is contained in:
hangzou 2020-11-02 16:48:46 +08:00 committed by GitHub
parent 4e8ea7e4c1
commit 39cf4fc8c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -12,9 +12,12 @@ const pkgs = getPackagesSync()
!name.includes('transition') &&
!name.includes('utils'),
)
const buildChild = (a, b) => {
const c1 = cp.spawn('node', ['./build/build.component.js', a, b])
const STEP = 4
const START = 0
const buildChild = (start, end) => {
let s = start
let e = end
const c1 = cp.spawn('node', ['./build/build.component.js', s, e])
c1.stdout.on('data', function (data) {
spinner.info(`${chalk.blue(data)}`)
})
@ -24,17 +27,17 @@ const buildChild = (a, b) => {
})
c1.on('close', function (code) {
a += 5
b += 5
if (a > pkgs.length && b > pkgs.length) {
s += STEP
e += STEP
if (s > pkgs.length) {
spinner.succeed(`${chalk.green('Build done. Exit code ' + code)}`)
return
}
buildChild(a, b)
buildChild(s, e)
})
}
/**
* @link https://github.com/ezolenko/rollup-plugin-typescript2/issues/177
*/
buildChild(0, 5)
buildChild(START, STEP)

View File

@ -24,6 +24,7 @@ const runBuild = async () => {
build(inputs[index])
async function build(name) {
if (!name) return
const inputOptions = {
input: path.resolve(__dirname, `../packages/${name.split('@element-plus/')[1]}/index.ts`),
plugins: [
@ -68,8 +69,6 @@ const runBuild = async () => {
index++
if (index < inputs.length) {
await build(inputs[index])
} else {
console.log('batch done')
}
}
}