UNPKG

@eljs/create

Version:
132 lines 3.45 kB
import { RunnerStageEnum, type AppData, type Config, type Paths, type Prompts } from "../types"; import { Pluggable, type ApplyAdd, type ApplyEvent, type ApplyModify, type PluggableOptions, type PluggablePluginApi } from '@eljs/pluggable'; import { prompts, type RequiredRecursive } from '@eljs/utils'; /** * 运行器 */ export declare class Runner extends Pluggable<Config> { /** * 配置项 */ config: RequiredRecursive<Config>; /** * 执行阶段 */ stage: RunnerStageEnum; /** * 项目路径 */ paths: Paths; /** * 应用数据 */ appData: AppData; /** * 命令行输入 */ prompts: Prompts; /** * tsConfig 配置 */ tsConfig: any; /** * jestConfig 配置 */ jestConfig: any; /** * prettierConfig 配置 */ prettierConfig: any; constructor(options: Omit<PluggableOptions, 'defaultConfigFiles'>); run(target: string, projectName: string): Promise<void>; private _resolveConfig; } /** * 运行器插件 Api */ export interface RunnerPluginApi extends PluggablePluginApi { /** * 用户配置 */ config: typeof Runner.prototype.config; /** * 应用数据,可通过 `modifyAppData` 方法修改 */ appData: typeof Runner.prototype.appData; /** * 项目路径,可通过 `modifyPaths` 方法修改 */ paths: Required<typeof Runner.prototype.paths>; /** * 命令行输入,可通过 `modifyPrompts` 方法修改 */ prompts: typeof Runner.prototype.prompts; /** * tsConfig 配置,可通过 `modifyTsConfig` 方法修改 */ tsConfig: typeof Runner.prototype.tsConfig; /** * jestConfig 配置,可通过 `modifyJestConfig` 方法修改 */ jestConfig: typeof Runner.prototype.jestConfig; /** * prettierConfig 配置,可通过 `modifyPrettierConfig` 方法修改 */ prettierConfig: typeof Runner.prototype.prettierConfig; /** * 添加命令行问询 */ addQuestions: ApplyAdd<{ cwd: string; }, prompts.PromptObject[]>; /** * 修改项目路径 */ modifyPaths: ApplyModify<typeof Runner.prototype.paths, null>; /** * 修改应用数据 */ modifyAppData: ApplyModify<typeof Runner.prototype.appData, null>; /** * 修改命令行输入数据 */ modifyPrompts: ApplyModify<typeof Runner.prototype.prompts, { questions: prompts.PromptObject[]; }>; /** * 修改 tsConfig */ modifyTsConfig: ApplyModify<typeof Runner.prototype.tsConfig, null>; /** * 修改 jestConfig */ modifyJestConfig: ApplyModify<typeof Runner.prototype.jestConfig, null>; /** * 修改 prettierConfig */ modifyPrettierConfig: ApplyModify<typeof Runner.prototype.prettierConfig, null>; /** * 应用启动事件 */ onStart: ApplyEvent<null>; /** * 生成文件之前事件 */ onBeforeGenerateFiles: ApplyEvent<{ prompts: Record<string, any>; paths: Paths; }>; /** * 生成文件事件 */ onGenerateFiles: ApplyEvent<// eslint-disable-next-line @typescript-eslint/no-explicit-any { prompts: Record<string, any>; paths: Paths; }>; /** * 生成文件完成事件 */ onGenerateDone: ApplyEvent<null>; } //# sourceMappingURL=runner.d.ts.map