UNPKG

2.4 kBTypeScriptView Raw
1import { PromptModule } from '@ionic/cli-framework';
2import { BaseBuildOptions, BuildOptions, CommandLineInputs, CommandLineOptions, CommandMetadata, CommandMetadataOption, IConfig, ILogger, IProject, IShell, Runner } from '../definitions';
3export declare const BUILD_SCRIPT = "ionic:build";
4export declare const COMMON_BUILD_COMMAND_OPTIONS: ReadonlyArray<CommandMetadataOption>;
5export interface BuildRunnerDeps {
6 readonly config: IConfig;
7 readonly log: ILogger;
8 readonly project: IProject;
9 readonly prompt: PromptModule;
10 readonly shell: IShell;
11}
12export declare abstract class BuildRunner<T extends BuildOptions<any>> implements Runner<T, void> {
13 protected abstract readonly e: BuildRunnerDeps;
14 abstract getCommandMetadata(): Promise<Partial<CommandMetadata>>;
15 abstract createOptionsFromCommandLine(inputs: CommandLineInputs, options: CommandLineOptions): T;
16 abstract buildProject(options: T): Promise<void>;
17 createBaseOptionsFromCommandLine(inputs: CommandLineInputs, options: CommandLineOptions): BaseBuildOptions;
18 determineEngineFromCommandLine(options: CommandLineOptions): string;
19 beforeBuild(options: T): Promise<void>;
20 run(options: T): Promise<void>;
21 afterBuild(options: T): Promise<void>;
22}
23export declare abstract class BuildCLI<T extends object> {
24 protected readonly e: BuildRunnerDeps;
25 /**
26 * The pretty name of this Build CLI.
27 */
28 abstract readonly name: string;
29 /**
30 * The npm package of this Build CLI.
31 */
32 abstract readonly pkg: string;
33 /**
34 * The bin program to use for this Build CLI.
35 */
36 abstract readonly program: string;
37 /**
38 * If specified, `package.json` is inspected for this script to use instead
39 * of `program`.
40 */
41 abstract readonly script?: string;
42 resolvedProgram: string;
43 constructor(e: BuildRunnerDeps);
44 /**
45 * Build the arguments for starting this Build CLI. Called by `this.run()`.
46 */
47 protected abstract buildArgs(options: T): Promise<string[]>;
48 build(options: T): Promise<void>;
49 protected runWrapper(options: T): Promise<void>;
50 protected run(options: T): Promise<void>;
51 protected resolveProgram(): Promise<string>;
52 protected promptToInstall(): Promise<boolean>;
53}
54export declare function build(deps: BuildRunnerDeps, inputs: CommandLineInputs, options: CommandLineOptions): Promise<void>;