UNPKG

@the-goat/core

Version:

![npm version](https://badgen.net/npm/v/@the-goat/goat?icon=npm) ![npm downloads](https://badgen.net/npm/dt/@the-goat/goat?icon=npm) ![npm weekly downloads](https://badgen.net/npm/dw/@the-goat/goat?icon=npm) ![npm licence](https://badgen.net/npm/license/@

83 lines (82 loc) 2.14 kB
import { Command } from 'commander'; import { JSONSchema6 } from 'json-schema'; import GoatEvents from './events/GoatEvents'; import { IGoatExternalProjectConfig } from './config'; interface IGoatTaskOption { allowOnOnce?: boolean; allowOnWatch?: boolean; flags: string; label: string; } export declare type TGoatTaskMethodConfig = GoatTask & { options: Command; }; interface IGoatTaskConfig { name: string; description: string; schema: JSONSchema6; init?: { files?: () => { files: { destination: string; name: string; data: string | Uint8Array; }[]; }; }; command: string; method: (command: TGoatTaskMethodConfig) => Promise<void>; watch?: (command: TGoatTaskMethodConfig) => void; options?: IGoatTaskOption[]; } /** * Class defining all Goat tasks */ export default class GoatTask { name: string; private key; description: string; schema: JSONSchema6; path: string; init?: { files?: () => { files: { destination: string; name: string; data: string | Uint8Array; }[]; }; }; configuration: IGoatExternalProjectConfig; private readonly command; readonly method: (command: TGoatTaskMethodConfig) => Promise<void>; readonly watch?: (command: TGoatTaskMethodConfig) => void; events: GoatEvents; options: IGoatTaskOption[]; constructor(build: IGoatTaskConfig); /** * Build the commander command object */ private buildCommand; /** * Method to be executed by running Goat command. */ action(config: any): void | Promise<void>; /** * Goat configuration object of the current project */ private getConfiguration; /** * Forms the base of all Goat actions, */ actionBase(config: Command): Promise<void>; /** * Base function for watch tasks */ watchBase(config: Command, events: GoatEvents): void; /** * Build command */ getCommand(): Command; } export {};