From 535554164833d7a186ce78a8e7822574dc2df72e Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 24 Apr 2024 16:45:14 +0100 Subject: [PATCH] refactor: split out task running and config loading --- core/cli/src/tasks.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/cli/src/tasks.ts b/core/cli/src/tasks.ts index a53825245..81f5cebb9 100644 --- a/core/cli/src/tasks.ts +++ b/core/cli/src/tasks.ts @@ -56,9 +56,7 @@ const loadTasks = async ( return reduceValidated(taskResults) } -export async function runTasks(logger: Logger, commands: string[], files?: string[]): Promise { - const config = await loadConfig(logger) - +export async function runTasksFromConfig(logger: Logger, config: ValidConfig, commands: string[], files?: string[]): Promise { for (const pluginOptions of Object.values(config.pluginOptions)) { if (pluginOptions.forPlugin) { setOptions(pluginOptions.forPlugin.id as OptionKey, pluginOptions.options) @@ -131,3 +129,9 @@ ${error.details}` } } } + +export async function runTasks(logger: Logger, commands: string[], files?: string[]): Promise { + const config = await loadConfig(logger) + + return runTasksFromConfig(logger, config, commands, files) +}