Skip to content

Commit

Permalink
Simplify getInputs function (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiaojx authored Jun 12, 2020
1 parent 17ffcd2 commit 14bfa39
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,16 @@ async function getInputs(
entries?: string | string[],
source?: string
): Promise<string[]> {
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
Expand Down

0 comments on commit 14bfa39

Please sign in to comment.