UNPKG

59.5 kBTypeScriptView Raw
1declare module "task.transforms" {
2 import { Task } from "task.resolve";
3 export interface TaskTransform {
4 predicate: (incoming: Task) => boolean;
5 fn: (incoming: Task) => Task;
6 }
7 /**
8 * Task Transformations
9 * This gives an opportunity to change a task just before error collection
10 */
11 export const transforms: {
12 "@sh from File": {
13 predicate(incoming: Task): boolean;
14 fn(incoming: Task): Task;
15 };
16 };
17 /**
18 * Allow transformations on tasks before error collections
19 */
20 export function applyTransforms(incoming: Task): Task;
21}
22declare module "task.sequence.factories" {
23 import { Task } from "task.resolve";
24 import { CommandTrigger } from "command.run";
25 import { TaskStats } from "task.runner";
26 export enum SequenceItemTypes {
27 SeriesGroup,
28 ParallelGroup,
29 Task,
30 }
31 export interface SequenceItem {
32 type: SequenceItemTypes;
33 taskName?: string;
34 task?: Task;
35 items: SequenceItem[];
36 factory?: (opts: any, ctx: CommandTrigger, observer: Rx.Observer<any>) => any;
37 fnName?: string;
38 options?: any;
39 subTaskName?: string;
40 stats?: TaskStats;
41 seqUID: number;
42 skipped?: boolean;
43 viaName?: string;
44 }
45 export interface SequenceSeriesGroup {
46 taskName: string;
47 skipped: boolean;
48 items: any[];
49 }
50 export interface SequenceParallelGroup extends SequenceSeriesGroup {
51 }
52 export interface SequenceTask {
53 fnName: string;
54 factory: TaskFactory;
55 task: Task;
56 options: any;
57 subTaskName?: string;
58 viaName?: string;
59 }
60 export interface TaskFactory {
61 (task: Task, trigger: CommandTrigger): any;
62 tasks?: TaskFactory[];
63 name?: string;
64 }
65 export function createSequenceTaskItem(incoming: SequenceTask): SequenceItem;
66 export function createSequenceSeriesGroup(incoming: SequenceSeriesGroup): SequenceItem;
67 export function createSequenceParallelGroup(incoming: SequenceParallelGroup): SequenceItem;
68}
69declare module "task.return.values" {
70 export default function handleReturnType(output: any, cb: () => void): any;
71}
72declare module "watch.preprocess" {
73 export interface OutgoingWatchTask {
74 rawInput: string;
75 taskName: string;
76 patterns: string[];
77 tasks: string[];
78 }
79 export function preprocessWatchTask(taskName: string): OutgoingWatchTask;
80}
81declare module "watch.errors" {
82 import { CrossbowInput } from "index";
83 import { OutgoingWatchTask } from "watch.preprocess";
84 export enum WatchTaskErrorTypes {
85 WatchTaskNameNotFound,
86 }
87 export interface WatchTaskError {
88 type: WatchTaskErrorTypes;
89 }
90 export interface WatchTaskNameNotFoundError extends WatchTaskError {
91 taskName: string;
92 }
93 export function gatherWatchTaskErrors(outgoing: OutgoingWatchTask, input: CrossbowInput): WatchTaskError[];
94}
95declare module "watch.resolve" {
96 import { WatchOptions } from "chokidar";
97 import { WatchTaskError } from "watch.errors";
98 import { CrossbowInput } from "index";
99 import { Tasks } from "task.resolve";
100 import { SequenceItem } from "task.sequence.factories";
101 import { Runner } from "task.runner";
102 import { CommandTrigger } from "command.run";
103 import { TaskCollection } from "task.resolve";
104 export const defaultWatchOptions: CBWatchOptions;
105 export interface CBWatchOptions extends WatchOptions {
106 throttle: number;
107 debounce: number;
108 delay: number;
109 block: boolean;
110 }
111 export interface WatchTask {
112 before: string[];
113 options: CBWatchOptions;
114 watchers: Watcher[];
115 name: string;
116 errors: WatchTaskError[];
117 patterns?: string[];
118 tasks?: string[];
119 }
120 export interface Watcher {
121 patterns: string[];
122 tasks: TaskCollection;
123 options: any;
124 watcherUID: string;
125 _tasks?: Tasks;
126 _sequence?: SequenceItem[];
127 _runner?: Runner;
128 parent?: string;
129 }
130 export interface WatchTasks {
131 valid: WatchTask[];
132 invalid: WatchTask[];
133 all: WatchTask[];
134 }
135 export function resolveWatchTasks(taskNames: string[], trigger: CommandTrigger): WatchTasks;
136 /**
137 * The goal of this function is to produce a flat array containing tasks as strings
138 * this allows us to feed that into the task resolution stuff
139 */
140 export function resolveBeforeTasks(beforeFlagsFromCliOrConfig: string[], input: CrossbowInput, watchTasks: WatchTask[]): string[];
141}
142declare module "task.sequence" {
143 import { Task } from "task.resolve";
144 import { CommandTrigger } from "command.run";
145 import { Runner } from "task.runner";
146 import { SequenceItem } from "task.sequence.factories";
147 import { TaskReport } from "task.runner";
148 export function createFlattenedSequence(tasks: Task[], trigger: CommandTrigger): SequenceItem[];
149 /**
150 * If the current TaskType is an InlineFunction or
151 * module to be run,
152 */
153 export interface ITaskOptions {
154 _default?: any;
155 [index: string]: any;
156 }
157 /**
158 * ******************
159 * Where the **--~~Magic~~--** happens!!!
160 * ******************
161 *
162 * Creating a task runner in crossbow is really about
163 * wrapping the process of running the tasks in a way
164 * that allows comprehensive logging/reporting
165 *
166 * Series & Parallel have different semantics and are
167 * therefor handled separately.
168 *
169 * Note that everything here is completely lazy and
170 * nothing will be executed until a user calls subscribe
171 */
172 export function createRunner(items: SequenceItem[], trigger: CommandTrigger): Runner;
173 /**
174 * After a bunch of tasks have run, we need to link up task-ended reports
175 * with their original position in the sequence. This will allow us to
176 * reconstruct the task render-tree but also show any tasks that errored
177 * or did not complete
178 * @param sequence
179 * @param reports
180 * @returns {*}
181 */
182 export function decorateSequenceWithReports(sequence: SequenceItem[], reports: TaskReport[]): any;
183 /**
184 * Look at every item in the sequence tree and count how many
185 * error have occured
186 */
187 export function countSequenceErrors(items: SequenceItem[]): number;
188 export function collectSkippedTasks(items: SequenceItem[], initial: any): SequenceItem[];
189 export function collectRunnableTasks(items: SequenceItem[], initial: SequenceItem[]): SequenceItem[];
190}
191declare module "watch.before" {
192 import { WatchTasks } from "watch.resolve";
193 import { Tasks } from "task.resolve";
194 import { SequenceItem } from "task.sequence.factories";
195 import { CommandTrigger } from "command.run";
196 export interface BeforeTasks {
197 runner: any;
198 beforeTasksAsCliInput: string[];
199 tasks: Tasks;
200 sequence: SequenceItem[];
201 }
202 export function getBeforeTaskRunner(trigger: CommandTrigger, watchTasks: WatchTasks): BeforeTasks;
203}
204declare module "watch.runner" {
205 import { WatchTasks } from "watch.resolve";
206 import { Watcher } from "watch.resolve";
207 import { CommandTrigger } from "command.run";
208 import { BeforeTasks } from "watch.before";
209 export interface WatchRunners {
210 all: Watcher[];
211 valid: Watcher[];
212 invalid: Watcher[];
213 }
214 export interface WatchTaskRunner {
215 tasks: WatchTasks;
216 runners: WatchRunners;
217 before: BeforeTasks;
218 }
219 export function createWatchRunners(watchTasks: WatchTasks, ctx: CommandTrigger): WatchRunners;
220}
221declare module "reporters/task.list" {
222 import { Task } from "task.resolve";
223 import { WatchRunners } from "watch.runner";
224 import { TaskReport } from "task.runner";
225 export interface WriteableStream {
226 columns: number;
227 }
228 export function getSimpleTaskList(tasks: Task[], longest: number): string[];
229 export function twoCol(tasks: Task[], longest: number): Array<string[]>;
230 export function twoColWatchers(runners: WatchRunners): Array<string[]>;
231 export function _taskReport(report: TaskReport): string;
232 export function duration(ms: any): string;
233}
234declare module "file.utils" {
235 import { CrossbowConfiguration } from "config";
236 import { InputFiles, InputError } from "task.utils";
237 import { CrossbowInput } from "index";
238 import { ParsedPath } from "path";
239 import Rx = require("rx");
240 export interface ExternalFile {
241 rawInput: string;
242 resolved: string;
243 relative: string;
244 errors: InputError[];
245 parsed: ParsedPath;
246 }
247 export interface FileNotFoundError extends InputError {
248 }
249 export interface ExternalFileContent extends ExternalFile {
250 content: string;
251 data?: any;
252 }
253 export interface ExternalFileInput extends ExternalFile {
254 input: CrossbowInput | any;
255 }
256 /**
257 * Try to auto-load configuration files
258 * from the users CWD
259 */
260 export function retrieveDefaultInputFiles(config: CrossbowConfiguration): InputFiles;
261 /**
262 * Try to load cbfiles (like gulp) from the users
263 * working directory
264 * @param config
265 * @returns {InputFiles}
266 */
267 export function retrieveCBFiles(config: CrossbowConfiguration): InputFiles;
268 /**
269 * Try to retrieve input files from disk.
270 * This is different from regular file reading as
271 * we deliver errors with context
272 */
273 export function readInputFiles(paths: string[], cwd: string): InputFiles;
274 export function readFilesFromDiskWithContent(paths: string[], cwd: string): ExternalFileContent[];
275 export function readFileContent(file: ExternalFile): string;
276 export function writeFileToDisk(file: ExternalFile, content: string): void;
277 export function getStubFileWithContent(path: string, cwd: string): ExternalFileContent;
278 export function readOrCreateJsonFile(path: string, cwd: string): ExternalFileContent;
279 export function getStubFile(path: string, cwd: string): ExternalFile;
280 /**
281 * Take an array of paths and return file info + errors if they don't exist
282 * @param paths
283 * @param cwd
284 * @returns {ExternalFile[]}
285 */
286 export function readFilesFromDisk(paths: string[], cwd: string): ExternalFile[];
287 /**
288 * Attempt to use the LOCALLY installed crossbow version
289 * first, this will ensure anything registered with .task etc
290 * can be picked up by global installs too.
291 * @param config
292 * @returns {InputFiles}
293 */
294 export function getRequirePaths(config: CrossbowConfiguration): InputFiles;
295 export function getExternalFiles(dirpaths: string[], cwd: string): ExternalFile[];
296 export function getPossibleTasksFromDirectories(dirpaths: string[], cwd: string): string[];
297 export interface IHashItem {
298 userInput: string;
299 resolved: string;
300 hash: string;
301 changed: boolean;
302 }
303 export interface IHashInput {
304 userInput: string;
305 pathObj: ExternalFile;
306 }
307 export interface IHashResults {
308 output: IHashItem[];
309 markedHashes: IHashItem[];
310 }
311 export enum HashDirErrorTypes {
312 HashNotADirectory,
313 HashPathNotFound,
314 }
315 export interface HashDirError extends Error {
316 code: string;
317 path: string;
318 syscall: string;
319 }
320 export function hashItems(dirs: string[], cwd: string, existingHashes: IHashItem[]): Rx.Observable<IHashResults>;
321}
322declare module "command.init" {
323 import { CrossbowConfiguration } from "config";
324 import { CrossbowInput, CLI, CrossbowReporter } from "index";
325 import Rx = require("rx");
326 import * as file from "file.utils";
327 import { ExternalFile } from "file.utils";
328 export enum InitConfigFileErrorTypes {
329 InitInputFileExists,
330 InitInputFileTypeNotSupported,
331 }
332 export interface InitConfigError {
333 type: InitConfigFileErrorTypes;
334 }
335 export interface InitConfigFileExistsError extends InitConfigError {
336 file: file.ExternalFile;
337 }
338 export interface InitConfigFileTypeNotSupported extends InitConfigError {
339 providedType: InitConfigFileTypes;
340 supportedTypes: {};
341 }
342 export interface InitCommandOutput {
343 existingFilesInCwd: ExternalFile[];
344 matchingFiles: ExternalFile[];
345 errors: InitConfigError[];
346 outputFilePath?: string;
347 outputFileName?: string;
348 templateFilePath?: string;
349 }
350 export type InitCommandComplete = Rx.Observable<{
351 setup: InitCommandOutput;
352 }>;
353 export enum InitConfigFileTypes {
354 yaml,
355 js,
356 json,
357 cbfile,
358 }
359 export default function handleIncomingInitCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable<{
360 setup: InitCommandOutput;
361 }>;
362}
363declare module "logger" {
364 let logger: any;
365 export default logger;
366 export const compile: any;
367 export const prefix: string;
368 export const createAst: any;
369 export const clean: any;
370}
371declare module "command.docs" {
372 import { CrossbowConfiguration } from "config";
373 import { CrossbowInput, CLI, CrossbowReporter } from "index";
374 import { Tasks } from "task.resolve";
375 import Rx = require("rx");
376 import * as file from "file.utils";
377 export interface DocsError {
378 type: DocsErrorTypes;
379 }
380 export interface DocsInputFileNotFoundError extends DocsError {
381 file: file.ExternalFile;
382 }
383 export interface DocsOutputFileExistsError extends DocsInputFileNotFoundError {
384 }
385 export enum DocsErrorTypes {
386 DocsInputFileNotFound,
387 DocsOutputFileExists,
388 }
389 export const docStartComment: string;
390 export const docEndComment: string;
391 export const hasRegExp: RegExp;
392 export const hasExistingComments: (inputString: any) => boolean;
393 export const readmeRegExp: RegExp;
394 export interface DocsFileOutput {
395 file: file.ExternalFile;
396 content: string;
397 }
398 export interface DocsCommandOutput {
399 tasks: Tasks;
400 errors: DocsError[];
401 markdown?: string;
402 output?: DocsFileOutput[];
403 }
404 export type DocsCommandComplete = Rx.Observable<{
405 setup: DocsCommandOutput;
406 }>;
407 export default function handleIncomingDocsCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable<{
408 setup: DocsCommandOutput;
409 }>;
410}
411declare module "watch.shorthand" {
412 import { CommandTrigger } from "command.run";
413 export interface UnwrappedTask {
414 patterns: string[];
415 tasks: string[];
416 i: number;
417 name: string;
418 }
419 export function getModifiedWatchContext(trigger: CommandTrigger): CommandTrigger;
420 /**
421 * take the following:
422 * $ crossbow watch "*.js -> (lint) (unit)"
423 *
424 * and convert it into
425 * patterns: ["*.js"]
426 * tasks: ["lint", "unit"]
427 */
428 export function unwrapShorthand(incoming: string, i: number): UnwrappedTask;
429}
430declare module "watch.utils" {
431 export function stripBlacklisted(incoming: string[]): string[];
432}
433declare module "command.watch.interactive" {
434 import Rx = require("rx");
435 import { CLI, CrossbowInput } from "index";
436 import { CrossbowConfiguration } from "config";
437 export interface WatchAnswers {
438 watch: string[];
439 }
440 export default function promptForWatchCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration): Rx.Observable<WatchAnswers>;
441}
442declare module "command.watch" {
443 import { CommandTrigger } from "command.run";
444 import { CrossbowConfiguration } from "config";
445 import { CrossbowInput, CLI, CrossbowReporter } from "index";
446 import { WatchRunners } from "watch.runner";
447 import { WatchTasks } from "watch.resolve";
448 import { BeforeTasks } from "watch.before";
449 import Rx = require("rx");
450 import { WatchTaskReport, WatchRunnerComplete } from "watch.file-watcher";
451 import { ReportTypes } from "reporter.resolve";
452 export interface CrossbowError extends Error {
453 _cb: boolean;
454 }
455 export interface WatchCommandSetupErrors {
456 type: ReportTypes;
457 }
458 export interface WatchCommandOutput {
459 setup: WatchCommandSetup;
460 update$: Rx.Observable<WatchReport>;
461 }
462 export interface WatchCommandSetup {
463 beforeTasks?: BeforeTasks;
464 watchTasks?: WatchTasks;
465 watchRunners?: WatchRunners;
466 errors: WatchCommandSetupErrors[];
467 }
468 export type WatchCommmandComplete = Rx.Observable<WatchCommandOutput>;
469 export interface WatchReport {
470 type: WatchCommandEventTypes;
471 data: WatchTaskReport | WatchRunnerComplete;
472 }
473 export enum WatchCommandEventTypes {
474 SetupError,
475 FileEvent,
476 WatchTaskReport,
477 WatchRunnerComplete,
478 BeforeTasksComplete,
479 }
480 export default function handleIncomingWatchCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): WatchCommmandComplete;
481 export function getWatchCommandSetup(trigger: CommandTrigger): WatchCommandSetup;
482}
483declare module "watch.file-watcher" {
484 import { Watcher } from "watch.resolve";
485 import { CommandTrigger } from "command.run";
486 import { TaskReport } from "task.runner";
487 import Rx = require("rx");
488 import { SequenceItem } from "task.sequence.factories";
489 import { CrossbowReporter } from "index";
490 import { WatchCommandEventTypes } from "command.watch";
491 export interface WatchEventWithContext {
492 watchEvent: WatchEvent;
493 watcher: Watcher;
494 }
495 export interface WatchEvent {
496 event: string;
497 path: string;
498 watcherUID: string;
499 }
500 export interface WatchTaskReport {
501 taskReport: TaskReport;
502 watchEvent: WatchEvent;
503 count: number;
504 }
505 export interface WatchRunnerComplete {
506 sequence: SequenceItem[];
507 reports: TaskReport[];
508 errors: TaskReport[];
509 watchEvent: WatchEvent;
510 runtime: number;
511 }
512 /**
513 * Create a stream that is the combination of all watchers
514 */
515 export function createObservablesForWatchers(watchers: Watcher[], trigger: CommandTrigger): Rx.Observable<{
516 type: WatchCommandEventTypes;
517 data: WatchTaskReport | WatchRunnerComplete;
518 }>;
519 /**
520 * Create a file-system watcher that will emit <WatchEvent>
521 */
522 export function createObservableForWatcher(watcher: Watcher, trigger: CommandTrigger): Rx.Observable<WatchEvent>;
523 export function getFileChangeStream(watcher: Watcher, reporter: CrossbowReporter): Rx.Observable<WatchEvent>;
524}
525declare module "command.tasks" {
526 import { CrossbowConfiguration } from "config";
527 import { CrossbowInput, CLI, CrossbowReporter } from "index";
528 import { Tasks, Task } from "task.resolve";
529 import Rx = require("rx");
530 export interface TaskGroup {
531 title: string;
532 tasks: Tasks;
533 }
534 export interface TaskCommandSetup {
535 groups: TaskGroup[];
536 tasks: Task[];
537 errors: Error[];
538 }
539 export interface TasksCommandCompletionReport {
540 setup: TaskCommandSetup;
541 }
542 export type TasksCommandComplete = Rx.Observable<TasksCommandCompletionReport>;
543 export default function handleIncomingTasksCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): TasksCommandComplete;
544}
545declare module "command.watchers" {
546 import { CrossbowConfiguration } from "config";
547 import { CrossbowInput, CLI, CrossbowReporter } from "index";
548 import Rx = require("rx");
549 import { WatchTasks } from "watch.resolve";
550 import { WatchRunners } from "watch.runner";
551 import { ReportTypes } from "reporter.resolve";
552 export interface WatchersCommandError {
553 type: ReportTypes;
554 }
555 export interface WatchersCommandOutput {
556 watchTasks?: WatchTasks;
557 runners?: WatchRunners;
558 errors: WatchersCommandError[];
559 }
560 export type WatchersCommandComplete = Rx.Observable<{
561 setup: WatchersCommandOutput;
562 }>;
563 export default function handleIncomingWatchersCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable<{
564 setup: WatchersCommandOutput;
565 }>;
566}
567declare module "reporter.resolve" {
568 import { CrossbowConfiguration, OutgoingSignals } from "config";
569 import { CrossbowInput, CLI } from "index";
570 import { ExternalFile, ExternalFileInput, ExternalFileContent, HashDirErrorTypes } from "file.utils";
571 import { TaskReport } from "task.runner";
572 import { CommandTrigger } from "command.run";
573 import { SequenceItem } from "task.sequence.factories";
574 import { InitConfigFileExistsError, InitConfigFileTypeNotSupported } from "command.init";
575 import { ParsedPath } from "path";
576 import { Task, TaskCollection } from "task.resolve";
577 import { WatchTask, Watcher, WatchTasks } from "watch.resolve";
578 import { DocsInputFileNotFoundError, DocsOutputFileExistsError } from "command.docs";
579 import Rx = require("rx");
580 import { WatchEvent } from "watch.file-watcher";
581 import { TaskCommandSetup } from "command.tasks";
582 import { WatchersCommandOutput } from "command.watchers";
583 export interface Reporter {
584 errors: {}[];
585 type: ReporterTypes;
586 callable?: Function;
587 sources: ExternalFile[];
588 }
589 export enum ReporterErrorTypes {
590 ReporterFileNotFound,
591 ReporterTypeNotSupported,
592 }
593 export interface ReporterError {
594 type: ReporterErrorTypes;
595 file?: ExternalFile;
596 }
597 export interface ReporterFileNotFoundError extends ReporterError {
598 }
599 export interface ReporterTypeNotSupportedError extends ReporterError {
600 }
601 export enum ReporterTypes {
602 InlineFunction,
603 ExternalFile,
604 UnsupportedValue,
605 Muted,
606 }
607 export interface Reporters {
608 all: Reporter[];
609 valid: Reporter[];
610 invalid: Reporter[];
611 }
612 export enum ReportTypes {
613 DuplicateInputFile,
614 InputFileCreated,
615 InitInputFileTypeNotSupported,
616 InputError,
617 InputFileNotFound,
618 InvalidReporter,
619 UsingInputFile,
620 TaskList,
621 TaskTree,
622 TaskErrors,
623 TaskReport,
624 NoTasksAvailable,
625 NoTasksProvided,
626 SimpleTaskList,
627 BeforeWatchTaskErrors,
628 BeforeTaskList,
629 BeforeTasksDidNotComplete,
630 BeforeTasksSummary,
631 WatchTaskTasksErrors,
632 WatchTaskErrors,
633 WatchTaskReport,
634 NoFilesMatched,
635 NoWatchersAvailable,
636 NoWatchTasksProvided,
637 Watchers,
638 WatcherNames,
639 WatcherTriggeredTasksCompleted,
640 WatcherTriggeredTasks,
641 WatcherSummary,
642 DocsAddedToFile,
643 DocsGenerated,
644 DocsInputFileNotFound,
645 DocsOutputFileExists,
646 DocsInvalidTasksSimple,
647 HashDirError,
648 Summary,
649 SignalReceived,
650 CLIParserOutput,
651 }
652 export interface IncomingReport {
653 type: ReportTypes;
654 data?: any;
655 }
656 export interface OutgoingReport {
657 origin: ReportTypes;
658 data: string[];
659 }
660 export interface UsingConfigFileReport {
661 sources: ExternalFileInput[];
662 }
663 export interface InputFileNotFoundReport {
664 sources: ExternalFileInput[];
665 }
666 export interface InputErrorReport {
667 errors: any[];
668 sources: ExternalFileInput[];
669 }
670 export interface TaskReportReport {
671 report: TaskReport;
672 config: CrossbowConfiguration;
673 }
674 export interface SignalReceivedReport {
675 code: number;
676 }
677 export interface SummaryReport {
678 sequence: SequenceItem[];
679 cli: CLI;
680 config: CrossbowConfiguration;
681 runtime: number;
682 errors: TaskReport[];
683 }
684 export interface BeforeTasksSummaryReport {
685 sequence: SequenceItem[];
686 cli: CLI;
687 config: CrossbowConfiguration;
688 runtime: number;
689 errors: TaskReport[];
690 }
691 export interface WatcherSummaryReport {
692 sequence: SequenceItem[];
693 cli: CLI;
694 config: CrossbowConfiguration;
695 runtime: number;
696 errors: TaskReport[];
697 watchEvent: WatchEvent;
698 watcher: Watcher;
699 }
700 export interface TaskListReport {
701 sequence: SequenceItem[];
702 cli: CLI;
703 titlePrefix: string;
704 config: CrossbowConfiguration;
705 }
706 export interface SimpleTaskListReport {
707 setup: TaskCommandSetup;
708 }
709 export interface InvalidReporterReport {
710 reporters: Reporters;
711 }
712 export interface DuplicateConfigFile {
713 error: InitConfigFileExistsError;
714 }
715 export interface ConfigFileCreatedReport {
716 parsed: ParsedPath;
717 }
718 export interface InitInputFileTypeNotSupportedReport {
719 error: InitConfigFileTypeNotSupported;
720 }
721 export interface TaskTreeReport {
722 tasks: Task[];
723 config: CrossbowConfiguration;
724 title: string;
725 }
726 export interface TaskErrorsReport {
727 tasks: Task[];
728 taskCollection: TaskCollection;
729 input: CrossbowInput;
730 config: CrossbowConfiguration;
731 }
732 export interface WatchersReport {
733 watchTasks: WatchTask[];
734 }
735 export interface BeforeWatchTaskErrorsReport {
736 watchTasks: WatchTasks;
737 trigger: CommandTrigger;
738 }
739 export interface BeforeTaskListReport {
740 sequence: SequenceItem[];
741 cli: CLI;
742 config: CrossbowConfiguration;
743 }
744 export interface BeforeTasksDidNotCompleteReport {
745 error: Error;
746 }
747 export interface WatchTaskTasksErrorsReport {
748 tasks: Task[];
749 runner: Watcher;
750 config: CrossbowConfiguration;
751 }
752 export interface WatchTaskErrorsReport {
753 watchTasks: WatchTask[];
754 }
755 export interface WatchTaskReportReport {
756 report: TaskReport;
757 trigger: CommandTrigger;
758 }
759 export interface WatcherTriggeredTasksReport {
760 index: number;
761 taskCollection: TaskCollection;
762 }
763 export interface WatcherTriggeredTasksCompletedReport {
764 index: number;
765 taskCollection: TaskCollection;
766 time: number;
767 }
768 export interface WatcherNamesReport {
769 setup: WatchersCommandOutput;
770 }
771 export interface NoFilesMatchedReport {
772 watcher: Watcher;
773 }
774 export interface DocsInputFileNotFoundReport {
775 error: DocsInputFileNotFoundError;
776 }
777 export interface DocsAddedToFileReport {
778 file: ExternalFileContent;
779 }
780 export interface DocsOutputFileExistsReport {
781 error: DocsOutputFileExistsError;
782 }
783 export interface HashError extends Error {
784 type: HashDirErrorTypes;
785 }
786 export interface HashDirErrorReport {
787 error: HashError;
788 cwd: string;
789 }
790 export function getReporters(config: CrossbowConfiguration, input: CrossbowInput): Reporters;
791 export type OutgoingReporter = Rx.Subject<OutgoingReport>;
792 export function getOutputObserver(mergedConfig: CrossbowConfiguration, outputObserver: OutgoingReporter): Rx.Observable<OutgoingReport>;
793 export function getSignalReporter(mergedConfig: CrossbowConfiguration, signalObserver?: OutgoingSignals): OutgoingSignals;
794 export function getDefaultReporter(): any;
795}
796declare module "reporters/defaultReporter" {
797 import { SequenceItem } from "task.sequence.factories";
798 import { CrossbowConfiguration } from "config";
799 import { Task } from "task.resolve";
800 import * as reports from "reporter.resolve";
801 export const enum LogLevel {
802 Short = 0,
803 Verbose = 1,
804 }
805 export default function (report: reports.IncomingReport, observer: Rx.Observer<reports.OutgoingReport>): void;
806 export const reporterFunctions: {
807 [x: number]: ((report: reports.UsingConfigFileReport) => string) | ((report: reports.InputErrorReport) => string[]) | ((report: reports.InvalidReporterReport) => string[]) | ((report: reports.DuplicateConfigFile) => string[]) | ((report: reports.ConfigFileCreatedReport) => string[]) | ((report: reports.InitInputFileTypeNotSupportedReport) => string[]) | ((report: reports.SimpleTaskListReport) => string[]) | ((report: reports.TaskTreeReport) => string[]) | ((report: reports.TaskListReport) => string) | ((report: reports.TaskErrorsReport) => string[]) | ((report: reports.TaskReportReport) => string) | ((report: reports.BeforeWatchTaskErrorsReport) => string[]) | ((report: reports.BeforeTaskListReport) => string[]) | ((report: reports.BeforeTasksDidNotCompleteReport) => string[]) | ((report: reports.WatchTaskTasksErrorsReport) => string[]) | ((report: reports.WatchTaskErrorsReport) => string[]) | ((report: reports.WatchTaskReportReport) => string) | ((report: reports.WatcherNamesReport) => string[]) | ((report: reports.NoFilesMatchedReport) => string) | ((report: reports.WatcherTriggeredTasksReport) => string) | (() => void) | ((report: reports.DocsInputFileNotFoundReport) => string[]) | ((report: reports.DocsAddedToFileReport) => string) | ((report: reports.SignalReceivedReport) => string[]);
808 };
809 /**
810 * There are multiple ways to output trees to the screen,
811 * so this helper function helps to normalize the output
812 * by providing the same padding on all but the first line.
813 */
814 export function multiLineTree(tree: string): string;
815 export interface CrossbowError extends Error {
816 _cbError?: boolean;
817 _cbExitCode?: number;
818 }
819 export function getStack(stack: string[], config: CrossbowConfiguration): string[];
820 /**
821 * Show a tree of function calls
822 */
823 export function reportSequenceTree(sequence: SequenceItem[], config: CrossbowConfiguration, title: any, showStats?: boolean): string;
824 export function reportTaskTree(tasks: Task[], config: CrossbowConfiguration, title: string): string[];
825 export function getErrors(task: any): any;
826 export function getCleanLabel(task: Task): string;
827 export function getLabel(task: Task): string;
828}
829declare module "task.runner" {
830 import { Tasks } from "task.resolve";
831 import { SequenceItem } from "task.sequence.factories";
832 import { CommandTrigger } from "command.run";
833 import Rx = require("rx");
834 import Immutable = require("immutable");
835 export interface Runner {
836 series: (ctx?: RunContext) => Rx.Observable<TaskReport>;
837 parallel: (ctx?: RunContext) => Rx.Observable<TaskReport>;
838 sequence: SequenceItem[];
839 }
840 export interface TaskRunner {
841 tasks: Tasks;
842 sequence: SequenceItem[];
843 runner: Runner;
844 }
845 export interface TaskStats {
846 startTime: number;
847 endTime: number;
848 duration: number;
849 started: boolean;
850 completed: boolean;
851 errors: Error[];
852 skipped?: boolean;
853 skippedReadon?: TaskSkipReasons;
854 }
855 export interface TaskErrorStats {
856 endTime: number;
857 completed: boolean;
858 errors: Error[];
859 cbError?: boolean;
860 cbExitCode?: number;
861 }
862 export interface Report {
863 item: SequenceItem;
864 type: TaskReportType;
865 }
866 export enum TaskReportType {
867 start,
868 end,
869 error,
870 }
871 export enum TaskSkipReasons {
872 SkipFlag,
873 IfChanged,
874 }
875 export interface TaskReport extends Report {
876 stats: TaskStats;
877 }
878 export interface TaskErrorReport extends Report {
879 stats: TaskErrorStats;
880 }
881 export type RunContext = Immutable.Map<string, any>;
882 /**
883 * This creates a wrapper around the actual function that will be run.
884 * This done to allow the before/after reporting to work as expected for consumers
885 */
886 export function time(scheduler?: any): any;
887 export function createObservableFromSequenceItem(item: SequenceItem, trigger: CommandTrigger, ctx: RunContext): Rx.Observable<{}>;
888 /**
889 * Create a new stats object with startTime
890 */
891 export function getStartStats(startTime: number, additional?: {
892 [index: string]: any;
893 }): TaskStats;
894}
895declare module "task.utils" {
896 import { CrossbowConfiguration } from "config";
897 import { CommandTrigger } from "command.run";
898 import { ExternalFileInput, ExternalFile } from "file.utils";
899 import { Task } from "task.resolve";
900 import { CrossbowInput } from "index";
901 export enum InputErrorTypes {
902 InputFileNotFound,
903 NoTasksAvailable,
904 NoWatchersAvailable,
905 FileNotFound,
906 NotAFile,
907 InvalidYaml,
908 InvalidInput,
909 InvalidJson,
910 }
911 export interface InputFileNotFoundError extends InputError {
912 }
913 export interface NoTasksAvailableError extends InputError {
914 }
915 export interface NoWatchersAvailableError extends InputError {
916 }
917 export interface InputError {
918 type: InputErrorTypes;
919 }
920 export interface InputFiles {
921 all: ExternalFileInput[];
922 valid: ExternalFileInput[];
923 invalid: ExternalFileInput[];
924 }
925 export function locateModule(config: CrossbowConfiguration, taskName: string): ExternalFile[];
926 export function getChildTaskNames(task: Task): string[];
927 /**
928 * Convert a JS object into ENV vars
929 * eg:
930 * var obj = {
931 * options: {
932 * docker: {
933 * port: 8000
934 * }
935 * }
936 * }
937 * ->
938 * envifyObject(obj, 'CB', 'OPTIONS')
939 * ->
940 * CB_OPTIONS_DOCKER_PORT=8000
941 */
942 export function envifyObject(object: any, prefix: string, objectKeyName: string): any;
943 export function excludeKeys(input: any, blacklist: string[]): any;
944 export function getCBEnv(trigger: CommandTrigger): {};
945 export function getFunctionName(fn: any): string;
946 export const removeNewlines: (x: string) => string;
947 export const escapeNewLines: (x: string) => string;
948 export const removeTrailingNewlines: (x: string) => string;
949 export function stringifyObj(incoming: any, max?: number): string;
950 export function isPlainObject(val: any): boolean;
951 export function isString(val: any): boolean;
952 export function isFunction(val: any): boolean;
953 export function isReport(report: any): boolean;
954 export function isPrivateTask(taskName: string): boolean;
955 export function isPublicTask(taskName: string): boolean;
956 export function isParentGroupName(name: string): RegExpMatchArray;
957 export function isParentRef(name: string, names: string[]): boolean;
958 export function getChildItems(name: string, input: any): any;
959 export function getPossibleTaskNames(input: CrossbowInput): any[];
960 export function getChildName(name: any): any;
961 export function isInternal(incoming: string): boolean;
962 export function isSupportedFileType(incoming: any): boolean;
963 export function _e(x: any): any;
964 export function __e(x: any): any;
965 export function longestString(col: string[]): number;
966 export function getLongestTaskName(tasks: Task[]): number;
967 export function padLine(incoming: any, max?: any): any;
968 export function concatProps(tasks: any, initial: string[], propname: string): string[];
969}
970declare module "task.errors" {
971 import { Task } from "task.resolve";
972 import { CommandTrigger } from "command.run";
973 import { ExternalFile } from "file.utils";
974 export enum TaskErrorTypes {
975 TaskNotFound,
976 SubtasksNotInConfig,
977 SubtaskNotProvided,
978 SubtaskNotProvidedForParent,
979 SubtaskNotFound,
980 SubtaskWildcardNotAvailable,
981 AdaptorNotFound,
982 FlagNotFound,
983 CBFlagNotProvided,
984 InvalidTaskInput,
985 CircularReference,
986 FileTypeNotSupported,
987 }
988 export function gatherTaskErrors(task: Task, trigger: CommandTrigger): TaskError[];
989 export interface TaskError {
990 type: TaskErrorTypes;
991 }
992 export interface TaskNotFoundError extends TaskError {
993 taskName: string;
994 cwd: string;
995 possible: string[];
996 }
997 export interface SubtasksNotInConfigError extends TaskError {
998 name: string;
999 }
1000 export interface SubtaskNotProvidedError extends TaskError {
1001 name: string;
1002 }
1003 export interface SubtaskNotProvidedForParentError extends TaskError {
1004 name: string;
1005 available: string[];
1006 }
1007 export interface SubtaskWildcardNotAvailableError extends TaskError {
1008 name: string;
1009 }
1010 export interface SubtaskNotFoundError extends TaskError {
1011 name: string;
1012 }
1013 export interface AdaptorNotFoundError extends TaskError {
1014 taskName: string;
1015 }
1016 export interface InvalidTaskInputError extends TaskError {
1017 input: any;
1018 }
1019 export interface CBFlagNotFoundError extends TaskError {
1020 taskName: string;
1021 }
1022 export interface CBFlagNotProvidedError extends TaskError {
1023 taskName: string;
1024 }
1025 export interface CircularReferenceError extends TaskError {
1026 incoming: Task;
1027 parents: string[];
1028 }
1029 export interface FileTypeNotSupportedError extends TaskError {
1030 taskName: string;
1031 externalFile: ExternalFile;
1032 }
1033}
1034declare module "cli.parse" {
1035 import { CLI } from "index";
1036 export interface FlagOption {
1037 alias?: string;
1038 type?: CliFlagTypes;
1039 help?: string;
1040 }
1041 export interface FlagWithValues {
1042 name?: string;
1043 type?: CliFlagTypes;
1044 values?: any[];
1045 help?: string;
1046 }
1047 /**
1048 * As given by the user, eg:
1049 *
1050 * { verbose: {alias: 'v', count: true } }
1051 */
1052 export interface FlagOptions {
1053 [flagname: string]: FlagOption;
1054 }
1055 export interface Flags {
1056 [flagname: string]: FlagWithValues;
1057 help?: boolean;
1058 version?: boolean;
1059 }
1060 export interface FlagsWithValues extends FlagOption {
1061 values: string[];
1062 }
1063 export enum CliFlagTypes {
1064 Array,
1065 String,
1066 Boolean,
1067 Number,
1068 Count,
1069 }
1070 export interface CliInputAndFlags {
1071 input: string[];
1072 flags: Array<string[]>;
1073 }
1074 export interface FlagsOutput extends CLI {
1075 command: string;
1076 input: string[];
1077 rawFlags: Array<string[]>;
1078 flagValues: FlagWithValues;
1079 flags: Flags;
1080 trailing: string;
1081 }
1082 /**
1083 * Accept either string or array input
1084 */
1085 export default function parse(input: string | string[], opts?: FlagOptions): FlagsOutput;
1086}
1087declare module "task.preprocess" {
1088 import { Task } from "task.resolve";
1089 import { CrossbowInput } from "index";
1090 import { TaskRunModes, IncomingTaskItem } from "task.resolve";
1091 import { CommandTrigger } from "command.run";
1092 export function preprocessTask(taskName: IncomingTaskItem, trigger: CommandTrigger, parents: string[]): Task;
1093 export interface TaskLiteral {
1094 tasks?: IncomingTaskItem[];
1095 runMode?: TaskRunModes;
1096 input?: string;
1097 adaptor?: string;
1098 command?: string;
1099 description?: string;
1100 }
1101 export function handleObjectInput(taskLiteral: TaskLiteral, input: any, parents: any): any;
1102 export function handleArrayInput(taskItems: any[], input: CrossbowInput, parents: string[]): Task;
1103 export interface SplitTaskAndFlags {
1104 taskName: string;
1105 cbflags: string[];
1106 flags: {};
1107 query: any;
1108 }
1109}
1110declare module "task.tree.transforms" {
1111 import { Task } from "task.resolve";
1112 export interface TaskTreeTransform {
1113 predicate: (incoming: Task[]) => boolean;
1114 fn: (incoming: Task[]) => Task[];
1115 }
1116 export const transforms: {
1117 "Add skipped property to children": {
1118 predicate(tasks: Task[]): boolean;
1119 fn(tasks: Task[]): Task[];
1120 };
1121 "Add if property to children": {
1122 predicate(tasks: Task[]): boolean;
1123 fn(tasks: Task[]): Task[];
1124 };
1125 "Pass options/flags/query from Groups -> Tasks": {
1126 predicate(): boolean;
1127 fn(tasks: Task[]): Task[];
1128 };
1129 };
1130 /**
1131 * Allow transformations on tasks before error collections
1132 */
1133 export function applyTreeTransforms(incoming: Task[]): Task[];
1134}
1135declare module "task.resolve" {
1136 import { TaskError } from "task.errors";
1137 import { CrossbowInput } from "index";
1138 import { CommandTrigger } from "command.run";
1139 import { Task, Tasks } from "task.resolve";
1140 import { ExternalFile } from "file.utils";
1141 /**
1142 * Function.name is es6 & >
1143 */
1144 export interface CBFunction extends Function {
1145 name: string;
1146 }
1147 export type IncomingTaskItem = string | CBFunction | Task;
1148 export type IncomingInlineArray = {
1149 tasks: Array<IncomingTaskItem>;
1150 runMode: TaskRunModes;
1151 };
1152 export type TaskCollection = Array<IncomingTaskItem>;
1153 export enum TaskTypes {
1154 ExternalTask,
1155 Adaptor,
1156 TaskGroup,
1157 ParentGroup,
1158 InlineFunction,
1159 }
1160 export enum TaskOriginTypes {
1161 CrossbowConfig,
1162 NpmScripts,
1163 FileSystem,
1164 Adaptor,
1165 InlineFunction,
1166 InlineArray,
1167 InlineObject,
1168 InlineChildObject,
1169 }
1170 export enum TaskRunModes {
1171 series,
1172 parallel,
1173 }
1174 /**
1175 * Factory for creating a new Task Item
1176 * @param {object} obj
1177 * @returns {object}
1178 */
1179 export function createTask(obj: any): Task;
1180 /**
1181 * When a circular reference is detected, exit with the appropriate error
1182 */
1183 export function createCircularReferenceTask(incoming: Task, parents: string[]): Task;
1184 /**
1185 * Match a task name with a top-level value from 'tasks'
1186 */
1187 export function getTopLevelValue(baseTaskName: string, input: CrossbowInput): any;
1188 /**
1189 * Anything that begins @ is always an adaptor and will skip
1190 * file i/o etc.
1191 * @param taskName
1192 * @param parents
1193 * @returns {Task}
1194 */
1195 export function createAdaptorTask(taskName: any, parents: any): Task;
1196 /**
1197 * Look at a hash and determine if the incoming 'taskName'
1198 * could match a valid taskName.
1199 * eg:
1200 * $ crossbow run shane
1201 *
1202 * -> matches: 'shane' & 'shane@p'
1203 */
1204 export function maybeTaskNames(tasks: {}, taskName: string): string[];
1205 export function resolveTasks(taskCollection: TaskCollection, trigger: CommandTrigger): Tasks;
1206 export interface Task {
1207 adaptor?: string;
1208 command?: string;
1209 valid: boolean;
1210 taskName: string;
1211 baseTaskName: string;
1212 subTasks: string[];
1213 externalTasks: ExternalFile[];
1214 tasks: Task[];
1215 rawInput: string;
1216 parents: string[];
1217 errors: TaskError[];
1218 runMode: TaskRunModes;
1219 startTime?: number;
1220 endTime?: number;
1221 duration?: number;
1222 query: any;
1223 flags: any;
1224 options: any;
1225 cbflags: string[];
1226 origin: TaskOriginTypes;
1227 type: TaskTypes;
1228 inlineFunctions: Array<CBFunction>;
1229 env: any;
1230 description: string;
1231 skipped: boolean;
1232 ifChanged: string[];
1233 }
1234 export interface TasknameWithOrigin {
1235 items: string[];
1236 origin: TaskOriginTypes;
1237 }
1238 export interface Tasks {
1239 valid: Task[];
1240 invalid: Task[];
1241 all: Task[];
1242 }
1243}
1244declare module "config" {
1245 import { TaskRunModes } from "task.resolve";
1246 import { LogLevel } from "reporters/defaultReporter";
1247 import { OutgoingReport } from "reporter.resolve";
1248 import { InitConfigFileTypes } from "command.init";
1249 import { WatchEvent } from "watch.file-watcher";
1250 import { ExternalFile } from "file.utils";
1251 import Rx = require("rx");
1252 export enum SignalTypes {
1253 Exit,
1254 FileWrite,
1255 }
1256 export interface CBSignal<T> {
1257 type: SignalTypes;
1258 data?: T;
1259 }
1260 export type OutgoingSignals = Rx.Subject<CBSignal<ExitSignal | FileWriteSignal>>;
1261 export interface ExitSignal {
1262 code: number;
1263 }
1264 export interface FileWriteSignal {
1265 file: ExternalFile;
1266 content: string;
1267 }
1268 export interface CrossbowConfiguration {
1269 cwd: string;
1270 runMode: TaskRunModes;
1271 verbose: LogLevel;
1272 parallel: boolean;
1273 fail: boolean;
1274 force: boolean;
1275 reporter: string;
1276 handoff: boolean;
1277 input: string[];
1278 interactive: boolean;
1279 outputOnly: boolean;
1280 suppressOutput: boolean;
1281 progress: boolean;
1282 cbfile?: string;
1283 dump: boolean;
1284 envPrefix: string;
1285 env: any;
1286 before: string[];
1287 type?: InitConfigFileTypes;
1288 debug: boolean;
1289 reporters: Array<string | Function>;
1290 skip: string[];
1291 tasksDir: string[];
1292 nodeModulesPaths: string[];
1293 block?: boolean;
1294 debounce?: boolean;
1295 throttle?: boolean;
1296 fromJson?: string;
1297 file?: string;
1298 output?: string;
1299 dryRun?: boolean;
1300 dryRunDuration?: number;
1301 outputObserver?: Rx.Observable<OutgoingReport>;
1302 fileChangeObserver?: Rx.Observable<WatchEvent>;
1303 signalObserver?: OutgoingSignals;
1304 scheduler?: Rx.IScheduler;
1305 }
1306 /**
1307 * Merge default with incoming opts.
1308 * Also deal with single char flag
1309 * @returns {*}
1310 */
1311 export function merge(opts: CrossbowConfiguration | any): CrossbowConfiguration;
1312}
1313declare module "input.resolve" {
1314 import { CrossbowInput } from "index";
1315 import { CrossbowConfiguration } from "config";
1316 import * as file from "file.utils";
1317 export enum InputTypes {
1318 DefaultExternalFile,
1319 ExternalFile,
1320 InlineObject,
1321 CBFile,
1322 InlineJSON,
1323 }
1324 export interface UserInput {
1325 errors: any[];
1326 sources: file.ExternalFileInput[];
1327 type: InputTypes;
1328 inputs: CrossbowInput[];
1329 }
1330 export function getInputs(config: CrossbowConfiguration, inlineInput?: any): UserInput;
1331 /**
1332 * `Input` is the object that is looked at to resolve tasks/options and
1333 * watchers
1334 */
1335 export function generateBaseInput(incoming: CrossbowInput | any): CrossbowInput;
1336}
1337declare module "index" {
1338 import { CrossbowConfiguration, OutgoingSignals } from "config";
1339 import { UserInput } from "input.resolve";
1340 import * as reports from "reporter.resolve";
1341 import { OutgoingReporter } from "reporter.resolve";
1342 export interface CLI {
1343 input: string[];
1344 flags: any;
1345 trailing?: string;
1346 command?: string;
1347 }
1348 export interface CrossbowInput {
1349 tasks: any;
1350 watch: any;
1351 options: any;
1352 env?: any;
1353 config?: any;
1354 }
1355 export interface CrossbowReporter {
1356 (report: reports.IncomingReport): void;
1357 }
1358 export interface PreparedInputErrors {
1359 type: reports.ReportTypes;
1360 }
1361 export interface PreparedInput {
1362 cli: CLI;
1363 config: CrossbowConfiguration;
1364 reportFn?: CrossbowReporter;
1365 userInput: UserInput;
1366 errors: PreparedInputErrors[];
1367 }
1368 /**
1369 * Handle any type of init. It could be from the CLI, or via the API.
1370 * eg, any command from the CLI ultimately ends up in the following call
1371 * $ crossbow run task1 -c conf/cb.js
1372 * -> handleIncoming({
1373 * input: ['run', 'task1'],
1374 * flags: {c: 'conf/cb.js'}
1375 * });
1376 */
1377 export function prepareInput(cli: CLI, input?: CrossbowInput | any, outputObserver?: OutgoingReporter, signalObserver?: OutgoingSignals): PreparedInput;
1378 /**
1379 * This the the proxy that allows command/run mode to be handled
1380 * @param preparedInput
1381 */
1382 export function handleIncoming<ReturnType>(preparedInput: PreparedInput): ReturnType;
1383 /**
1384 * This is the default export that can be
1385 * used as a convenience method.
1386 * Note: types are lost when using this method.
1387 */
1388 export default function (cli: CLI, input?: CrossbowInput): any;
1389}
1390declare module "command.run.interactive" {
1391 import Rx = require("rx");
1392 import { CLI, CrossbowInput, CrossbowReporter } from "index";
1393 import { CrossbowConfiguration } from "config";
1394 import { Task } from "task.resolve";
1395 export interface Answers {
1396 tasks: string[];
1397 }
1398 export default function prompt(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): Rx.Observable<Answers>;
1399 export function getTaskList(tasks: Task[]): {
1400 name: any;
1401 value: string;
1402 }[];
1403}
1404declare module "command.run.context" {
1405 import { Task } from "task.resolve";
1406 import Immutable = require("immutable");
1407 import { CommandTrigger } from "command.run";
1408 import Rx = require("rx");
1409 /**
1410 * A task context is just an Immutable Map of key=>value pairs
1411 * that may be used to provide addition context to the task running
1412 * environment. This is especially useful in situations where you need
1413 * to do something that MUST block the task running altogether. An example
1414 * would be hashing files/directories to determine if a task/group of tasks should
1415 * run.
1416 */
1417 export default function getContext(tasks: Task[], trigger: CommandTrigger): Rx.Observable<Immutable.Map<string, any>>;
1418}
1419declare module "command.run.execute" {
1420 import { CommandTrigger } from "command.run";
1421 import { Tasks } from "task.resolve";
1422 import { SequenceItem } from "task.sequence.factories";
1423 import { Runner } from "task.runner";
1424 import { TaskReport } from "task.runner";
1425 import Rx = require("rx");
1426 import { CrossbowConfiguration } from "config";
1427 import { CLI } from "index";
1428 export enum RunCommandReportTypes {
1429 NoTasks,
1430 Setup,
1431 Complete,
1432 TaskReport,
1433 }
1434 export interface RunCommandSetupErrors {
1435 type: RunCommandReportTypes;
1436 }
1437 export type RunComplete = Rx.Observable<RunActions>;
1438 export interface RunActions {
1439 setup: RunCommandSetup;
1440 update$: Rx.Observable<TaskReport>;
1441 }
1442 export interface RunCommandSetup {
1443 tasks?: Tasks;
1444 sequence?: SequenceItem[];
1445 errors: RunCommandSetupErrors[];
1446 }
1447 export interface RunCommandCompletionReport {
1448 tasks: Tasks;
1449 sequence: SequenceItem[];
1450 runner: Runner;
1451 config: CrossbowConfiguration;
1452 reports?: TaskReport[];
1453 decoratedSequence?: SequenceItem[];
1454 runtime?: number;
1455 errors: RunCommandSetupErrors[];
1456 taskErrors: TaskReport[];
1457 cli: CLI;
1458 }
1459 export default function executeRunCommand(trigger: CommandTrigger): RunActions;
1460}
1461declare module "command.run" {
1462 import Rx = require("rx");
1463 import { CLI, CrossbowInput, CrossbowReporter } from "index";
1464 import { CrossbowConfiguration } from "config";
1465 import { SequenceItem } from "task.sequence.factories";
1466 import { Tasks } from "task.resolve";
1467 import { Runner } from "task.runner";
1468 import Immutable = require("immutable");
1469 import { RunComplete } from "command.run.execute";
1470 import { WatchEvent } from "watch.file-watcher";
1471 import { Watcher } from "watch.resolve";
1472 export interface CommandTrigger {
1473 type: TriggerTypes;
1474 cli: CLI;
1475 input: CrossbowInput;
1476 config: CrossbowConfiguration;
1477 tracker?: any;
1478 tracker$?: any;
1479 shared?: Rx.BehaviorSubject<Immutable.Map<string, any>>;
1480 reporter: CrossbowReporter;
1481 watchEvent?: WatchEvent;
1482 watcher?: Watcher;
1483 }
1484 export interface RunCommandSetup {
1485 tasks: Tasks;
1486 sequence: SequenceItem[];
1487 runner: Runner;
1488 }
1489 export enum TriggerTypes {
1490 command,
1491 watcher,
1492 }
1493 export function getRunCommandSetup(trigger: CommandTrigger): RunCommandSetup;
1494 export default function handleIncomingRunCommand(cli: CLI, input: CrossbowInput, config: CrossbowConfiguration, reporter: CrossbowReporter): RunComplete;
1495}
1496declare module "adaptors/@npm" {
1497 import { CommandTrigger } from "command.run";
1498 import { CrossbowConfiguration } from "config";
1499 import { Task } from "task.resolve";
1500 import { EventEmitter } from "events";
1501 export interface CommandOptions {
1502 cwd: string;
1503 env: any;
1504 stdio: any;
1505 }
1506 export interface CrossbowSpawnError extends Error {
1507 code: string;
1508 errno: string;
1509 syscall: string;
1510 file: string;
1511 }
1512 export interface CBEmitter extends EventEmitter {
1513 stdin: any;
1514 stdout: any;
1515 stderr: any;
1516 raw: any;
1517 kill: any;
1518 }
1519 function runCommand(args: string[], options: CommandOptions): CBEmitter;
1520 /**
1521 * Add the local ./node_modules/.bin directory to the beginning
1522 * of the users PATH - this will allow it to find local scripts
1523 * @param {process.env} process
1524 * @param {Immutable.Map} config
1525 * @returns {object}
1526 */
1527 function getEnv(process: any, config: CrossbowConfiguration): any;
1528 export interface CommandArgs {
1529 stringInput?: string;
1530 cmd?: string[];
1531 errors: Error[];
1532 }
1533 function getArgs(command: string): CommandArgs;
1534 export function teardown(emitter: any, task: Task): void;
1535 export function getStdio(trigger: CommandTrigger): (string | NodeJS.WritableStream | NodeJS.ReadableStream)[];
1536 export function handleExit(emitter: any, done: any): void;
1537 /**
1538 * The main export is the function this will be run in the sequence
1539 * @returns {Function}
1540 */
1541 export default function (task: Task, trigger: CommandTrigger): (opts: any, ctx: any, done: any) => () => void;
1542 export { runCommand, getArgs, getEnv };
1543}
1544declare module "adaptors/@cb" {
1545 import { CommandTrigger } from "command.run";
1546 import { Task } from "task.resolve";
1547 export default function (task: Task, trigger: CommandTrigger): (options: any, ctx: any, done: any) => any;
1548}
1549declare module "adaptors" {
1550 import { CommandTrigger } from "command.run";
1551 import { Task } from "task.resolve";
1552 const adaptors: {
1553 "shell": {
1554 validate: () => boolean;
1555 create: any;
1556 };
1557 "sh": {
1558 validate: () => boolean;
1559 create: any;
1560 };
1561 "bg": {
1562 validate: () => boolean;
1563 create: any;
1564 };
1565 "bgnpm": {
1566 validate: () => boolean;
1567 create: any;
1568 };
1569 "npm": {
1570 validate: () => boolean;
1571 create: (task: Task, trigger: CommandTrigger) => (opts: any, ctx: any, done: any) => () => void;
1572 };
1573 "cb": {
1574 validate: () => boolean;
1575 create: (task: Task, trigger: CommandTrigger) => (options: any, ctx: any, done: any) => any;
1576 };
1577 };
1578 export = adaptors;
1579}
1580declare module "adaptors/@bg" {
1581}
1582declare module "adaptors/@shell" {
1583}
1584declare module "cli.commands" {
1585 export interface CommandOption {
1586 alias: string[];
1587 description: string;
1588 opts: string[];
1589 help: string;
1590 }
1591 export interface CLICommands {
1592 [command: string]: CommandOption;
1593 }
1594 export const commands: CLICommands;
1595 export function twoColFromJson(json: any, rightSidePropertyName: string, leftside?: Function): string;
1596}
1597declare module "cli" {
1598 import { CLICommands } from "cli.commands";
1599 import { FlagsOutput } from "cli.parse";
1600 export interface PostCLIParse {
1601 cli: FlagsOutput;
1602 execute: boolean;
1603 output: string[];
1604 }
1605 export default function (args: string[]): PostCLIParse;
1606 export function getCommand(incoming: string, commands: CLICommands): string[];
1607}
1608declare module "cb" {
1609 import { TaskReport } from "task.runner";
1610 import { RunCommandSetup } from "command.run";
1611 export interface CLIResults {
1612 setup: RunCommandSetup;
1613 reports: TaskReport[];
1614 timestamp: number;
1615 }
1616}
1617declare module "command.run.post-execution" {
1618 import { RunCommandCompletionReport } from "command.run.execute";
1619 export function postCliExecution(complete: RunCommandCompletionReport): void;
1620}
1621declare module "command.run.pre-execution" {
1622 import { Task } from "task.resolve";
1623 import { CommandTrigger } from "command.run";
1624 import Rx = require("rx");
1625 export function createHashes(tasks: Task[], trigger: CommandTrigger): Rx.Observable<{
1626 [index: string]: any;
1627 }>;
1628}
1629declare module "public/create" {
1630 import { CBWatchOptions } from "watch.resolve";
1631 import { CrossbowConfiguration } from "config";
1632 import { WatchReport } from "command.watch";
1633 import { CLI } from "index";
1634 import IDisposable = Rx.IDisposable;
1635 let input: {
1636 tasks: {};
1637 watch: {};
1638 options: {};
1639 env: {};
1640 config: CrossbowConfiguration;
1641 cli: CLI;
1642 reporter: () => void;
1643 };
1644 export const api: {
1645 input: {
1646 tasks: {};
1647 watch: {};
1648 options: {};
1649 env: {};
1650 config: CrossbowConfiguration;
1651 cli: CLI;
1652 reporter: () => void;
1653 };
1654 env: (obj: any) => void;
1655 config: (obj: any) => void;
1656 task: (taskname: string) => {
1657 options: (hash: any) => void;
1658 };
1659 group: (groupName: string, tasks: {}) => void;
1660 options: (incoming: {}) => void;
1661 watch: (patterns: string[], tasks: string[], options?: CBWatchOptions) => IDisposable;
1662 watcher: (patterns: string[], tasks: string[], options?: CBWatchOptions) => Rx.Observable<WatchReport>;
1663 };
1664 export default input;
1665}
1666declare module "public/index" {
1667}
1668declare module "reporters/error.AdaptorNotFound" {
1669}
1670declare module "reporters/error.CBFlagNotProvided" {
1671}
1672declare module "reporters/error.CircularReference" {
1673}
1674declare module "reporters/error.DocsInputFileNotFound" {
1675}
1676declare module "reporters/error.DocsOutputFileExists" {
1677}
1678declare module "reporters/error.FileTypeNotSupported" {
1679}
1680declare module "reporters/error.HashNotADirectory" {
1681}
1682declare module "reporters/error.HashPathNotFound" {
1683}
1684declare module "reporters/error.InitInputFileExists" {
1685}
1686declare module "reporters/error.InitInputFileTypeNotSupported" {
1687}
1688declare module "reporters/error.InputFileNotFound" {
1689}
1690declare module "reporters/error.InvalidInput" {
1691}
1692declare module "reporters/error.InvalidJson" {
1693}
1694declare module "reporters/error.InvalidTaskInput" {
1695}
1696declare module "reporters/error.InvalidYaml" {
1697}
1698declare module "reporters/error.NoTasksAvailable" {
1699}
1700declare module "reporters/error.NoWatchersAvailable" {
1701}
1702declare module "reporters/error.ReporterFileNotFound" {
1703}
1704declare module "reporters/error.ReporterTypeNotSupported" {
1705}
1706declare module "reporters/error.SubtaskNotFound" {
1707}
1708declare module "reporters/error.SubtaskNotProvided" {
1709}
1710declare module "reporters/error.SubtaskNotProvidedForParent" {
1711}
1712declare module "reporters/error.SubtasksNotInConfig" {
1713}
1714declare module "reporters/error.SubtaskWildcardNotAvailable" {
1715}
1716declare module "reporters/error.TaskNotFound" {
1717}
1718declare module "reporters/error.WatchTaskNameNotFound" {
1719}