UNPKG

3.96 kBTypeScriptView Raw
1import { Blueprint, Contract, PackageStructure, Path, PortablePath, Predicates, Project } from '@boost/common';
2import { Debugger } from '@boost/debug';
3import { Event } from '@boost/event';
4import { Writable } from '@boost/log';
5import { Registry } from '@boost/plugin';
6import { Translator } from '@boost/translate';
7import { Config } from './Config';
8import { ConfigContext } from './contexts/ConfigContext';
9import { Context } from './contexts/Context';
10import { DriverContext } from './contexts/DriverContext';
11import { ScaffoldContext } from './contexts/ScaffoldContext';
12import { ScriptContext } from './contexts/ScriptContext';
13import { Driver } from './Driver';
14import { Script } from './Script';
15import { Argv, ConfigFile } from './types';
16export interface ToolOptions {
17 argv: Argv;
18 cwd?: PortablePath;
19 projectName?: string;
20 resourcePaths?: string[];
21}
22export declare class Tool extends Contract<ToolOptions> {
23 config: ConfigFile;
24 context?: Context;
25 errStream?: Writable;
26 outStream?: Writable;
27 package: PackageStructure;
28 readonly argv: Argv;
29 readonly configManager: Config;
30 readonly cwd: Path;
31 readonly debug: Debugger;
32 readonly driverRegistry: Registry<Driver>;
33 readonly msg: Translator;
34 readonly project: Project;
35 readonly onResolveDependencies: Event<[ConfigContext<{}>, Driver<{}, import("./types").DriverOptions>[]], string>;
36 readonly onRunCreateConfig: Event<[ConfigContext<{}>, string[]], string>;
37 readonly onRunDriver: Event<[DriverContext<import("./contexts/DriverContext").DriverContextOptions>, Driver<{}, import("./types").DriverOptions>], string>;
38 readonly onRunScaffold: Event<[ScaffoldContext, string, string, (string | undefined)?], string>;
39 readonly onRunScript: Event<[ScriptContext], string>;
40 readonly scriptRegistry: Registry<Script>;
41 constructor(options: ToolOptions);
42 blueprint({ array, instance, string, union }: Predicates): Blueprint<ToolOptions>;
43 bootstrap(): Promise<void>;
44 /**
45 * If the config module has an index that exports a function,
46 * execute it with the current tool instance.
47 */
48 bootstrapConfigModule(): Promise<this>;
49 /**
50 * Validate the configuration module and return an absolute path to its root folder.
51 */
52 getConfigModuleRoot(): Path;
53 /**
54 * Delete config files if a process fails.
55 */
56 cleanupOnFailure(error?: Error): void;
57 /**
58 * Create a pipeline to run the create config files flow.
59 */
60 createConfigurePipeline(args: ConfigContext['args'], driverNames?: string[]): import("@boost/pipeline").SerialPipeline<{}, ConfigContext<{}>, Path[], Path[]>;
61 /**
62 * Execute all routines for the chosen driver.
63 */
64 createRunDriverPipeline(args: DriverContext['args'], driverName: string, parallelArgv?: Argv[]): import("@boost/pipeline").SerialPipeline<{}, DriverContext<import("./contexts/DriverContext").DriverContextOptions>, unknown, unknown>;
65 /**
66 * Run a script found within the configuration module.
67 */
68 createRunScriptPipeline(args: ScriptContext['args'], scriptName: string): import("@boost/pipeline").SerialPipeline<{}, ScriptContext, unknown, unknown>;
69 /**
70 * Create a pipeline to run the scaffolding flow.
71 */
72 createScaffoldPipeline(args: ScaffoldContext['args'], generator: string, action: string, name?: string): import("@boost/pipeline").SerialPipeline<{}, ScaffoldContext, unknown, unknown>;
73 /**
74 * Resolve modules on *behalf* of the configuration module and within the context
75 * of its dependencies. This functionality is necessary to satisfy Yarn PnP and
76 * resolving plugins that aren't listed as direct dependencies.
77 */
78 resolveForPnP(id: string): string;
79 /**
80 * Prepare the context object by setting default values for specific properties.
81 */
82 protected prepareContext<T extends Context>(context: T): T;
83}
84//# sourceMappingURL=Tool.d.ts.map
\No newline at end of file