import { Project, SourceFile } from 'ts-morph'; import { VendurePluginRef } from './vendure-plugin-ref'; export type CommandCategory = | `Plugin` | `Plugin: UI` | `Plugin: Entity` | `Plugin: Service` | `Plugin: API` | `Plugin: Job Queue` | `Project: Codegen` | `Other`; export interface BaseCliCommandOptions { plugin?: VendurePluginRef; } export type CliCommandReturnVal = Record> = { project: Project; modifiedSourceFiles: SourceFile[]; } & T; export interface CliCommandOptions { id: string; category: CommandCategory; description: string; run: (options?: Partial) => Promise; } export class CliCommand, R extends CliCommandReturnVal = CliCommandReturnVal> { constructor(private options: CliCommandOptions) {} get id() { return this.options.id; } get category() { return this.options.category; } get description() { return this.options.description; } run(options?: Partial): Promise { return this.options.run(options); } }