All files / lib/task Pipeline.d.ts

0% Statements 0/71
0% Branches 0/1
0% Functions 0/1
0% Lines 0/71

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72                                                                                                                                               
import { Config } from "../types/Config";
import { PackageInfos } from "workspace-tools";
import { RunContext } from "../types/RunContext";
import { TargetConfig, TargetConfigFactory, TaskArgs } from "../types/PipelineDefinition";
import { TopologicalGraph } from "../types/TopologicalGraph";
import { Workspace } from "../types/Workspace";
/** individual targets to be kept track inside pipeline */
export interface PipelineTarget {
    id: string;
    packageName?: string;
    task: string;
    cwd: string;
    run?: (args: TaskArgs) => Promise<unknown> | void;
    deps?: string[];
    outputGlob?: string[];
    priority?: number;
    cache?: boolean;
    options?: any;
}
export declare const START_TARGET_ID = "__start";
/**
 * Pipeline class represents lage's understanding of the dependency graphs and wraps the promise graph implementations to execute tasks in order
 */
export declare class Pipeline {
    private workspace;
    private config;
    /** Target represent a unit of work and the configuration of how to run it */
    targets: Map<string, PipelineTarget>;
    /** Target dependencies determine the run order of the targets  */
    dependencies: [string, string][];
    /** Internal cache of the package.json information */
    packageInfos: PackageInfos;
    /** Internal generated cache of the topological package graph */
    graph: TopologicalGraph;
    constructor(workspace: Workspace, config: Config);
    private maybeRunNpmTask;
    /**
     * Generates a package target during the expansion of the shortcut syntax
     */
    private generatePackageTarget;
    /**
     * Expands the shorthand notation to pipeline targets (executable units)
     */
    private expandShorthandTargets;
    /**
     * Given an id & factory, generate targets configurations
     * @param id
     * @param factory
     */
    private generateFactoryTargets;
    /**
     * Converts target configuration to pipeline target
     * @param id
     * @param target
     */
    private convertToPipelineTarget;
    /**
     * Adds a target definition (takes in shorthand, target config, or a target config factory)
     * @param id
     * @param targetDefinition
     */
    addTargetDefinition(id: string, targetDefinition: string[] | TargetConfig | TargetConfigFactory): void;
    /**
     * Adds all the target dependencies to the graph
     */
    addDependencies(): void;
    generateTargetGraph(): [string, string][];
    loadConfig(config: Config): void;
    private getTargetPriority;
    run(context: RunContext): Promise<void>;
}