Skip to content

Commit

Permalink
refactor: split out task running and config loading
Browse files Browse the repository at this point in the history
  • Loading branch information
apaleslimghost committed Jul 25, 2024
1 parent 4375316 commit a1b1e34
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/cli/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ const loadTasks = async (
return reduceValidated(taskResults).map(Object.fromEntries)
}

export async function runTasks(logger: Logger, commands: string[], files?: string[]): Promise<void> {
const config = await loadConfig(logger)

export async function runTasksFromConfig(logger: Logger, config: ValidConfig, commands: string[], files?: string[]): Promise<void> {
for (const pluginOptions of Object.values(config.pluginOptions)) {
if (pluginOptions.forPlugin) {
setOptions(pluginOptions.forPlugin.id as OptionKey, pluginOptions.options)
Expand Down Expand Up @@ -120,3 +118,9 @@ ${error.details}`
}
}
}

export async function runTasks(logger: Logger, commands: string[], files?: string[]): Promise<void> {
const config = await loadConfig(logger)

return runTasksFromConfig(logger, config, commands, files)
}

0 comments on commit a1b1e34

Please sign in to comment.