cli: some more docs for create types
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -40,10 +40,31 @@ export type AnyOptions = Record<string, string>;
|
||||
export type Prompt<TOptions> = DistinctQuestion<TOptions> & { name: string };
|
||||
|
||||
export interface Factory<TOptions extends AnyOptions> {
|
||||
/**
|
||||
* The name used for this factory.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* A description that describes what this factory creates to the user.
|
||||
*/
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* An optional options discovery step that is run
|
||||
* before the prompts to potentially fill in some of the options.
|
||||
*/
|
||||
optionsDiscovery?(): Promise<Partial<TOptions>>;
|
||||
|
||||
/**
|
||||
* Inquirer prompts that will be filled in either interactively or
|
||||
* through command line arguments.
|
||||
*/
|
||||
optionsPrompts?: ReadonlyArray<Prompt<TOptions>>;
|
||||
|
||||
/**
|
||||
* The main method of the factory that handles creation.
|
||||
*/
|
||||
create(options: TOptions, context?: CreateContext): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user