Skip to content

Commit

Permalink
fix: allow loadedConfig to be an async fn
Browse files Browse the repository at this point in the history
  • Loading branch information
tkdaj committed Aug 28, 2023
1 parent a7201b6 commit 076d493
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/load-parser-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ export default async ({ preset, config, parserOpts, presetConfig }, { cwd }) =>
loadedConfig = conventionalChangelogAngular;
}

loadedConfig = await (typeof loadedConfig === "function"
? isPlainObject(presetConfig)
? loadedConfig(presetConfig)
: promisify(loadedConfig)()
: loadedConfig);
if(typeof loadedConfig === "function") {
if(isPlainObject(presetConfig)) {
loadedConfig = isAsyncFunction(loadedConfig) ? await loadedConfig(presetConfig) : loadedConfig(presetConfig)
} else {
loadedConfig = isAsyncFunction(loadedConfig) ? await loadedConfig() : loadedConfig()
}
}

return { ...loadedConfig.parserOpts, ...parserOpts };
};

0 comments on commit 076d493

Please sign in to comment.