UNPKG

1.42 kBTypeScriptView Raw
1import { CrossbowConfiguration } from "./config";
2import { UserInput } from "./input.resolve";
3import * as reports from "./reporter.resolve";
4import { Reporters } from "./reporter.resolve";
5export interface CLI {
6 input: string[];
7 flags: any;
8 trailing?: string;
9 command?: string;
10}
11export interface CrossbowInput {
12 tasks: any;
13 watch: any;
14 options: any;
15 env?: any;
16 config?: any;
17}
18export interface CrossbowReporter {
19 (report: reports.IncomingReport): void;
20}
21export interface PreparedInputErrors {
22 type: reports.ReportTypes;
23 data?: any;
24}
25export interface PreparedInput {
26 cli: CLI;
27 config: CrossbowConfiguration;
28 reporters?: Reporters;
29 reportFn?: CrossbowReporter;
30 userInput: UserInput;
31 errors: PreparedInputErrors[];
32}
33/**
34 * This the the proxy that allows command/run mode to be handled
35 * @param preparedInput
36 */
37export declare function handleIncoming<ReturnType>(preparedInput: PreparedInput): ReturnType;
38/**
39 * Handle any type of init. It could be from the CLI, or via the API.
40 * eg, any command from the CLI ultimately ends up in the following call
41 * $ crossbow run task1 -c conf/cb.js
42 * -> handleIncoming({
43 * input: ['run', 'task1'],
44 * flags: {c: 'conf/cb.js'}
45 * });
46 */
47export declare function getSetup(cli: CLI, input?: CrossbowInput): any;
48export default function (cli: CLI, input?: CrossbowInput): any;