import { Chalk } from 'chalk'; import { Inquirer } from 'inquirer'; import { LoDashStatic } from 'lodash'; import { Signale } from 'signale'; import terminalLink from 'terminal-link'; import { Arguments } from 'yargs-parser'; import { CreateErrorReturn } from './error'; import tsc from './tsc'; import * as utils from '../utils'; import Options from '../utils/options'; export interface Api { args: Arguments; chalk: Chalk; commands: Command[]; cwd: string; error: CreateErrorReturn; inquirer: Inquirer; lodash: LoDashStatic; options?: Options; /** * TODO type definition * https://github.com/yiminghe/async-validator */ schemaValidator: any; signale: Signale; terminalLink: typeof terminalLink; tsc: typeof tsc; utils: typeof utils; /** * version of `imhele` */ version: string; [key: string]: any; } /** * @type O: Option name */ export interface CommandOptions { /** * alias of this option, use as `imhele [YOUR_COMMAND] -[ALIAS]` */ alias?: string; /** * short introduction of this option */ comment?: string; /** * full name of this option */ optionName: O | null; /** * type of option value */ type?: string | string[]; } /** * @type O: Options */ export interface Command { (): void; alias?: string; commandName: string; description?: string; hide?: boolean; options?: (O | CommandOptions)[]; schema?: any; version?: string; }