UNPKG

code-genius

Version:
98 lines (89 loc) 3.09 kB
import { CAC } from 'cac'; import { Options } from 'execa'; interface CommitType { emoji: string; code: string; description: string; } interface CommitScope { name: string; description: string; } interface CommitOptions { gitCommitTypes?: Array<CommitType>; gitCommitScopes?: Array<CommitScope>; } interface GitCommitOptions { emoji: boolean; type: string; scope: string; description: string; } type CommandOptions = { display: string; command: string; description: string; }; interface CommandsOptions { commit?: CommitOptions; fix?: { paths: string[]; }; } interface CodeGeniusOptions { commands?: CommandsOptions; plugins?: Plugins; } type BuiltInPlugin = (options?: CommandsOptions) => { name: string; describe?: string; command?: string; setup: (cli: CAC) => void; }; type BuiltInPlugins = Array<BuiltInPlugin>; type Plugins = Array<{ name: string; describe?: string; command?: string; setup: (cli: CAC) => void; }>; declare const eslintFix: (paths: string[]) => Promise<void>; declare const gitCommit: (type: string, scope: string, description: string) => Promise<void>; declare const eslintGlob: string[]; declare const ACTIVATION: boolean; declare const gitCommitTypes: Array<CommitType>; declare const gitCommitScopes: Array<CommitScope>; declare const defaultCommands: { display: string; command: string; description: string; }[]; declare const DEFAULT_CONFIG_FILES: string[]; declare const execCommand: (cmd: string, args: string[], options?: Options) => Promise<string>; declare function handleError(error: unknown): void; /** * 用户配置工厂函数 * @param config * @returns */ declare const defineConfig: (config: CodeGeniusOptions) => CodeGeniusOptions; /** * 动态加载用户配置文件 */ declare function loadConfigModule(): Promise<CodeGeniusOptions | undefined>; /** * 用于循环注册指令 * @param cli * @param config */ declare function setup(cli: CAC, plugins: BuiltInPlugins): Promise<void>; declare const loggerInfo: (content: string) => void; declare const loggerWarring: (content: string | unknown) => void; declare const loggerSuccess: (content: string) => void; declare const loggerError: (content: string | unknown) => void; declare const printInfo: (content: string) => void; declare const printWarring: (content: string) => void; declare const printSuccess: (content: string) => void; declare const printError: (content: string | unknown) => void; declare const plugins: BuiltInPlugins; export { ACTIVATION, type BuiltInPlugin, type BuiltInPlugins, type CodeGeniusOptions, type CommandOptions, type CommandsOptions, type CommitOptions, type CommitScope, type CommitType, DEFAULT_CONFIG_FILES, type GitCommitOptions, type Plugins, defaultCommands, defineConfig, eslintFix, eslintGlob, execCommand, gitCommit, gitCommitScopes, gitCommitTypes, handleError, loadConfigModule, loggerError, loggerInfo, loggerSuccess, loggerWarring, plugins, printError, printInfo, printSuccess, printWarring, setup };