UNPKG

3.46 kBTypeScriptView Raw
1import { CrossbowConfiguration } from "./config";
2import { CommandTrigger } from "./command.run";
3import { ExternalFileInput, ExternalFile } from "./file.utils";
4import { Task } from "./task.resolve";
5import { CrossbowInput } from "./index";
6export declare enum InputErrorTypes {
7 InputFileNotFound,
8 NoTasksAvailable,
9 NoWatchersAvailable,
10 FileNotFound,
11 NotAFile,
12 InvalidYaml,
13 InvalidInput,
14 InvalidJson,
15 BinDirectoryNotFound,
16 BinPathNotADirectory,
17 EnvFileNotFound,
18 EnvFileParseError,
19}
20export interface InputFileNotFoundError extends InputError {
21}
22export interface NoTasksAvailableError extends InputError {
23}
24export interface NoWatchersAvailableError extends InputError {
25}
26export interface InputError {
27 type: InputErrorTypes;
28}
29export interface InputFiles {
30 all: ExternalFileInput[];
31 valid: ExternalFileInput[];
32 invalid: ExternalFileInput[];
33}
34export declare function locateModule(config: CrossbowConfiguration, taskName: string): ExternalFile[];
35export declare function getChildTaskNames(task: Task): string[];
36/**
37 * Convert a JS object into ENV vars
38 * eg:
39 * var obj = {
40 * options: {
41 * docker: {
42 * port: 8000
43 * }
44 * }
45 * }
46 * ->
47 * envifyObject(obj, 'CB', 'OPTIONS')
48 * ->
49 * CB_OPTIONS_DOCKER_PORT=8000
50 */
51export declare function envifyObject(object: any, prefix: string, objectKeyName: string): any;
52export declare function envifyObjectPlain(object: any, prefixes: string[]): any;
53export declare function excludeKeys(input: any, blacklist: string[]): any;
54/**
55 * Make some task context vars available as env vars
56 * eg:
57 *
58 * $cb_ctx_watcheEvent_path
59 * $cb_ctx_type
60 *
61 * etc...
62 *
63 * @param {CommandTrigger} trigger
64 * @param ctx
65 * @returns {any}
66 */
67export declare function getContextEnv(trigger: CommandTrigger, ctx: any): any;
68export declare function getCBEnv(trigger: CommandTrigger): {};
69export declare function getFunctionName(fn: any): string;
70export declare const removeNewlines: (x: string) => string;
71export declare const escapeNewLines: (x: string) => string;
72export declare const removeTrailingNewlines: (x: string) => string;
73export declare function stringifyObj(incoming: any, max?: number): string;
74export declare function isPlainObject(val: any): boolean;
75export declare function isString(val: any): boolean;
76export declare function isFunction(val: any): boolean;
77export declare function isReport(report: any): boolean;
78export declare function isPrivateTask(taskName: string): boolean;
79export declare function isPublicTask(taskName: string): boolean;
80export declare function isParentGroupName(name: string): RegExpMatchArray;
81export declare function isParentRef(name: string, names: string[]): boolean;
82export declare function getChildItems(name: string, input: any): any;
83export declare function getPossibleTaskNames(input: CrossbowInput): any[];
84export declare function getChildName(name: any): any;
85export declare function isInternal(incoming: string): boolean;
86export declare function isSupportedFileType(incoming: any): boolean;
87export declare function _e(x: any): any;
88export declare function __e(x: any): any;
89export declare function longestString(col: string[]): number;
90export declare function getLongestTaskName(tasks: Task[]): number;
91export declare function padLine(incoming: any, max?: any): any;
92export declare function concatProps(tasks: any, initial: string[], propname: string): string[];