From 427af02776df772db51d29dbec030af810553ac9 Mon Sep 17 00:00:00 2001 From: Juanra GM Date: Fri, 27 Oct 2023 16:43:57 +0200 Subject: [PATCH] refactor(cli): add the config path --- packages/cli/src/Command/CommandAbstract.ts | 1 + packages/cli/src/Factory/CommandFactory.ts | 3 ++- packages/cli/src/cli.ts | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/Command/CommandAbstract.ts b/packages/cli/src/Command/CommandAbstract.ts index a2fd007..9f020cb 100644 --- a/packages/cli/src/Command/CommandAbstract.ts +++ b/packages/cli/src/Command/CommandAbstract.ts @@ -37,6 +37,7 @@ export abstract class CommandAbstract< readonly globalOptions: GlobalOptions, options: TUnresolvedOptions, streams: Partial = {}, + readonly configPath?: string, ) { this.options = parseOptions(options, this.onOptions()); this.streams = createStreams(streams); diff --git a/packages/cli/src/Factory/CommandFactory.ts b/packages/cli/src/Factory/CommandFactory.ts index 6e81834..73dddb6 100644 --- a/packages/cli/src/Factory/CommandFactory.ts +++ b/packages/cli/src/Factory/CommandFactory.ts @@ -71,9 +71,10 @@ export function CommandFactory( globalOptions: GlobalOptions, options: OptionsMapType[TCommand], streams?: Partial, + configPath?: string, ) { const constructor = CommandConstructorFactory(type); - return new constructor(globalOptions, options as any, streams); + return new constructor(globalOptions, options as any, streams, configPath); } export async function exec( diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index cd6c54d..e8c7158 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -77,6 +77,8 @@ function makeCommandAction(command: CommandEnum) { config: config.data, }, options as any, + {}, + globalOptions.config, ).onExec(); } catch (e) { const error = e as Error;