From 14bfa39bc1cb920ceda51c70aa25b40f6a4768d5 Mon Sep 17 00:00:00 2001 From: Shaw <784487301@qq.com> Date: Fri, 12 Jun 2020 19:25:17 +0800 Subject: [PATCH] Simplify getInputs function (#745) --- src/index.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/index.ts b/src/index.ts index bcc53c17f..13bcea067 100755 --- a/src/index.ts +++ b/src/index.ts @@ -85,19 +85,16 @@ async function getInputs( entries?: string | string[], source?: string ): Promise { - let inputs: string[] = []; - let stub: any[] = []; - stub - .concat( - entries && entries.length - ? entries - : (source && resolveApp(source)) || - ((await isDir(resolveApp('src'))) && (await jsOrTs('src/index'))) - ) - .map(file => glob(file)) - .forEach(input => inputs.push(input)); - - return concatAllArray(inputs); + return concatAllArray( + ([] as any[]) + .concat( + entries && entries.length + ? entries + : (source && resolveApp(source)) || + ((await isDir(resolveApp('src'))) && (await jsOrTs('src/index'))) + ) + .map(file => glob(file)) + ); } prog