UNPKG

800 BTypeScriptView Raw
1import * as Config from '.';
2export interface Hooks {
3 [event: string]: object;
4 init: {
5 id: string | undefined;
6 argv: string[];
7 };
8 prerun: {
9 Command: Config.Command.Class;
10 argv: string[];
11 };
12 update: {};
13 'command_not_found': {
14 id: string;
15 };
16 'plugins:parse': {
17 pjson: Config.IPlugin;
18 };
19}
20export declare type Hook<K extends keyof Hooks> = (this: Hook.Context, options: Hooks[K] & {
21 config: Config.IConfig;
22}) => any;
23export declare namespace Hook {
24 interface Context {
25 exit(code?: number): void;
26 error(message: string | Error, options?: {
27 code?: string;
28 exit?: number;
29 }): void;
30 warn(message: string): void;
31 log(message?: any): void;
32 }
33}