From 39cf4fc8c1b137c2ea89380adbf59d60ece0b61a Mon Sep 17 00:00:00 2001 From: hangzou Date: Mon, 2 Nov 2020 16:48:46 +0800 Subject: [PATCH] fix(build): improve code style (#528) --- build/bincomp.js | 19 +++++++++++-------- build/build.component.js | 3 +-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build/bincomp.js b/build/bincomp.js index c44a15c805..939ca26280 100644 --- a/build/bincomp.js +++ b/build/bincomp.js @@ -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) diff --git a/build/build.component.js b/build/build.component.js index 4e4fe6f065..3a7c8a9e75 100644 --- a/build/build.component.js +++ b/build/build.component.js @@ -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') } } }