import { SelectOptions, Option, TextOptions, PasswordOptions, MultiSelectOptions, ConfirmOptions } from '@clack/prompts'; type ParsedFn = (parsed: Record) => Promise | V; interface PromptSelect extends Omit, 'options' | 'message'> { type: 'select'; key: string; message?: string; options: ParsedFn[]> | Option[]; } interface PromptMultiselect extends Omit, 'options' | 'message'> { type: 'multiselect'; key: string; message?: string; options: ParsedFn[]> | Option[]; } interface PromptConfirm extends Omit { type: 'confirm'; key: string; message?: string; } interface PromptText extends Omit { type: 'text'; key: string; message?: string; } interface PromptPassword extends Omit { type: 'password'; key: string; message?: string; } interface PromptHandler { type: 'handler'; key: string; handler: ParsedFn; } type Prompt = PromptSelect | PromptText | PromptPassword | PromptMultiselect | PromptConfirm | PromptHandler; interface Environment { [key: string]: string; } interface EnvironmentOptions { entries?: string[]; before?: Environment; after?: Environment; depth?: boolean; } interface Command extends Omit, 'message' | 'options'>, EnvironmentOptions { message?: string; prompts?: Prompt[]; command: string | Option[]; } type Script = Command | string; interface UserConfig { dts?: boolean | string; injects?: EnvironmentOptions; scripts?: { [command: string]: Script | string; }; } interface LoadEnvironmentOptions { /** * set environment variables entry * * @example * // load .env, .env.local * entry: ['env', 'local'] */ entries?: string[]; /** * set environment variables * * @example * // set environment variables * values: { * NODE_ENV: 'production', * PORT: '3000' * } */ env?: Record; /** * set environment variables to .env file */ write?: boolean; /** * command to run */ run?: string | string[]; /** * deep load and merge environment variables */ depth?: boolean; } export type { Command, Environment, EnvironmentOptions, LoadEnvironmentOptions, ParsedFn, Prompt, PromptConfirm, PromptHandler, PromptMultiselect, PromptPassword, PromptSelect, PromptText, Script, UserConfig };