Skip to content

Commit

Permalink
Simplify getInputs function (jaredpalmer#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiaojx authored and paul-vd committed Dec 1, 2020
1 parent faa9fb2 commit 66bcdd4
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))
);
}

function getNamesAndFiles(
Expand Down

0 comments on commit 66bcdd4

Please sign in to comment.