UNPKG

3.15 kBTypeScriptView Raw
1import { PromptModule } from '@ionic/cli-framework';
2import { BaseBuildOptions, BuildOptions, CommandLineInputs, CommandLineOptions, CommandMetadata, CommandMetadataOption, IConfig, ILogger, IProject, IShell, NpmClient, Runner } from '../definitions';
3export declare const BUILD_SCRIPT = "ionic:build";
4export declare const COMMON_BUILD_COMMAND_OPTIONS: readonly 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 getPkgManagerBuildCLI(): PkgManagerBuildCLI;
18 createBaseOptionsFromCommandLine(inputs: CommandLineInputs, options: CommandLineOptions): BaseBuildOptions;
19 determineEngineFromCommandLine(options: CommandLineOptions): string;
20 beforeBuild(options: T): Promise<void>;
21 run(options: T): Promise<void>;
22 afterBuild(options: T): Promise<void>;
23}
24export declare abstract class BuildCLI<T extends object> {
25 protected readonly e: BuildRunnerDeps;
26 /**
27 * The pretty name of this Build CLI.
28 */
29 abstract readonly name: string;
30 /**
31 * The npm package of this Build CLI.
32 */
33 abstract readonly pkg: string;
34 /**
35 * The bin program to use for this Build CLI.
36 */
37 abstract readonly program: string;
38 /**
39 * If specified, `package.json` is inspected for this script to use instead
40 * of `program`.
41 */
42 abstract readonly script?: string;
43 /**
44 * If true, the Build CLI will not prompt to be installed.
45 */
46 readonly global: boolean;
47 private _resolvedProgram?;
48 constructor(e: BuildRunnerDeps);
49 readonly resolvedProgram: string;
50 /**
51 * Build the arguments for starting this Build CLI. Called by `this.run()`.
52 */
53 protected abstract buildArgs(options: T): Promise<string[]>;
54 resolveScript(): Promise<string | undefined>;
55 build(options: T): Promise<void>;
56 protected runWrapper(options: T): Promise<void>;
57 protected run(options: T): Promise<void>;
58 protected resolveProgram(): Promise<string>;
59 protected promptToInstall(): Promise<boolean>;
60}
61declare abstract class PkgManagerBuildCLI extends BuildCLI<BaseBuildOptions> {
62 readonly abstract program: NpmClient;
63 readonly global = true;
64 readonly script = "ionic:build";
65 protected resolveProgram(): Promise<string>;
66 protected buildArgs(options: BaseBuildOptions): Promise<string[]>;
67}
68export declare class NpmBuildCLI extends PkgManagerBuildCLI {
69 readonly name = "npm CLI";
70 readonly pkg = "npm";
71 readonly program = "npm";
72}
73export declare class YarnBuildCLI extends PkgManagerBuildCLI {
74 readonly name = "Yarn";
75 readonly pkg = "yarn";
76 readonly program = "yarn";
77}
78export {};