Skip to content

Commit

Permalink
fix: await build:js correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
teppeis committed Mar 28, 2019
1 parent 330aeb6 commit 1ba1bcf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/commands/buildJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ import {EntryConfig, loadEntryConfig} from '../entryconfig';
/**
* @throws If compiler throws errors
*/
export async function buildJs(config: DuckConfig, entryConfigs?: string[], printConfig = false) {
export async function buildJs(
config: DuckConfig,
entryConfigs?: string[],
printConfig = false
): Promise<any> {
const entryConfigPaths = entryConfigs
? entryConfigs
: await findEntryConfigs(assertString(config.entryConfigDir));
const limit = pLimit(config.concurrency);
entryConfigPaths.map(entryConfigPath =>
const promises = entryConfigPaths.map(entryConfigPath =>
limit(async () => {
const entryConfig = await loadEntryConfig(entryConfigPath);
if (entryConfig.modules) {
Expand All @@ -31,6 +35,7 @@ export async function buildJs(config: DuckConfig, entryConfigs?: string[], print
console.error(e);
})
);
return Promise.all(promises);
}

async function findEntryConfigs(entryConfigDir: string): Promise<string[]> {
Expand Down

0 comments on commit 1ba1bcf

Please sign in to comment.