From a1b1e344f5e3037a979f9244bf08e21b5cb8e137 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 d47b82ba4..0f1b77a39 100644 --- a/core/cli/src/tasks.ts +++ b/core/cli/src/tasks.ts @@ -56,9 +56,7 @@ const loadTasks = async ( return reduceValidated(taskResults).map(Object.fromEntries) } -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) @@ -120,3 +118,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) +}