UNPKG

4.56 kBTypeScriptView Raw
1import { ExecaError, ExecaReturnValue } from 'execa';
2import { Arguments, Argv, Command, MapOptionConfig, MapParamConfig, OptionConfigMap, ParserOptions, PrimitiveType } from '@boost/args';
3import { Path, PortablePath } from '@boost/common';
4import { PluginsSetting } from '@boost/config';
5import { Pluggable } from '@boost/plugin';
6import type { Context } from './contexts/Context';
7import type { ScriptContext } from './contexts/ScriptContext';
8import type { Tool } from './Tool';
9export type { Arguments, Argv, ParserOptions };
10export declare type BeemoTool = Tool;
11export interface BeemoProcess<C extends Context = Context> {
12 context: C;
13 tool: BeemoTool;
14}
15export declare type UnknownSettings = Record<string, unknown>;
16export interface BootstrapFile {
17 (tool: BeemoTool): Promise<void> | void;
18 bootstrap?: (tool: BeemoTool) => Promise<void> | void;
19 default?: (tool: BeemoTool) => Promise<void> | void;
20}
21export declare type Execution = ExecaReturnValue;
22export declare type ExecutionError = ExecaError;
23export declare type DriverConfigStrategy = 'copy' | 'create' | 'native' | 'none' | 'reference' | 'template';
24export declare type DriverOutputStrategy = 'buffer' | 'none' | 'pipe' | 'stream';
25export interface DriverOptions {
26 args?: string[];
27 configStrategy?: DriverConfigStrategy;
28 dependencies?: string[];
29 env?: Record<string, string>;
30 expandGlobs?: boolean;
31 outputStrategy?: DriverOutputStrategy;
32 template?: string;
33}
34export interface DriverMetadata {
35 bin: string;
36 commandOptions: OptionConfigMap;
37 configName: string;
38 configOption: string;
39 configStrategy: 'copy' | 'create' | 'reference' | 'template';
40 dependencies: string[];
41 description: string;
42 filterOptions: boolean;
43 helpOption: string;
44 title: string;
45 useConfigOption: boolean;
46 versionOption: string;
47 watchOptions: string[];
48 workspaceStrategy: 'copy' | 'reference';
49}
50export interface DriverOutput {
51 stderr: string;
52 stdout: string;
53}
54export interface Driverable extends Pluggable<BeemoTool> {
55 metadata: DriverMetadata;
56}
57export interface DriverCommandConfig<O extends object, P extends PrimitiveType[]> extends Omit<Command, 'category'> {
58 allowUnknownOptions?: boolean;
59 allowVariadicParams?: boolean | string;
60 options?: MapOptionConfig<O>;
61 params?: MapParamConfig<P>;
62}
63export declare type DriverCommandRunner<O extends object, P extends PrimitiveType[]> = (tool: Tool, options: O, params: P, rest: string[]) => Promise<string | undefined | void> | string | undefined | void;
64export interface DriverCommandRegistration<O extends object, P extends PrimitiveType[]> {
65 path: string;
66 config: DriverCommandConfig<O, P>;
67 runner: DriverCommandRunner<O, P>;
68}
69export interface Scriptable<O extends object> extends Pluggable<BeemoTool> {
70 parse: () => ParserOptions<O>;
71 execute: (context: ScriptContext, args: Arguments<O>) => Promise<unknown>;
72}
73export interface RoutineOptions {
74 tool: BeemoTool;
75}
76export declare type ConfigExecuteStrategy = DriverOutputStrategy | '';
77export interface ConfigFile<T extends object = UnknownSettings> {
78 configure: {
79 cleanup: boolean;
80 parallel: boolean;
81 };
82 debug: boolean;
83 drivers: PluginsSetting;
84 execute: {
85 concurrency: number;
86 graph: boolean;
87 output: ConfigExecuteStrategy;
88 };
89 module: string;
90 scripts: PluginsSetting;
91 settings: T;
92}
93export interface BeemoConfig<T extends object = UnknownSettings> {
94 configure?: {
95 cleanup?: boolean;
96 parallel?: boolean;
97 };
98 debug?: boolean;
99 drivers?: PluginsSetting;
100 execute?: {
101 concurrency?: number;
102 graph?: boolean;
103 output?: ConfigExecuteStrategy;
104 };
105 module?: string;
106 scripts?: PluginsSetting;
107 settings?: T;
108}
109export declare type ConfigObject = Record<string, unknown>;
110export interface ConfigTemplateOptions {
111 configModule: string;
112 consumerConfigPath: Path | null;
113 context: Context;
114 driver: Driverable;
115 driverConfigPath: Path;
116 driverName: string;
117 providerConfigPath: Path | null;
118 templatePath: Path;
119 tool: BeemoTool;
120}
121export interface ConfigTemplateResult {
122 config: ConfigObject | string;
123 path?: PortablePath;
124}
125export declare type ConfigTemplate = (configs: ConfigObject[], options: ConfigTemplateOptions) => ConfigTemplateResult;
126declare global {
127 namespace NodeJS {
128 interface Process {
129 beemo: BeemoProcess;
130 }
131 }
132}
133//# sourceMappingURL=types.d.ts.map
\No newline at end of file