diff --git a/cli/codegen/commands.ts b/cli/codegen/commands.ts index 120c8bad..e4b82259 100644 --- a/cli/codegen/commands.ts +++ b/cli/codegen/commands.ts @@ -17,6 +17,7 @@ export interface OptionSchema { export interface CommandSchema { name: string + alias?: string[] description: string args: ArgSchema[] options: OptionSchema[] @@ -500,6 +501,8 @@ const PRE_PUBLISH_OPTIONS: CommandSchema = { name: 'prePublish', description: 'Update package.json and copy addons into per platform packages', args: [], + // compatible with old command name + alias: ['prepublish'], options: [ { name: 'cwd', diff --git a/cli/codegen/index.ts b/cli/codegen/index.ts index 55ea0721..eca5d203 100644 --- a/cli/codegen/index.ts +++ b/cli/codegen/index.ts @@ -85,9 +85,16 @@ function generateCommandDef(command: CommandSchema) { const prepare: string[] = [] const cmdLines: string[] = [] + let paths = `[['${commandPath}']]` + + if (command.alias) { + command.alias.unshift(commandPath) + paths = `[['${command.alias.join(', ')}']]` + } + cmdLines.push(` export abstract class Base${PascalCase(command.name)}Command extends Command { - static paths = [['${commandPath}']] + static paths = ${paths} static usage = Command.Usage({ description: '${command.description}', diff --git a/cli/src/def/pre-publish.ts b/cli/src/def/pre-publish.ts index d2770735..5bc2326b 100644 --- a/cli/src/def/pre-publish.ts +++ b/cli/src/def/pre-publish.ts @@ -3,7 +3,7 @@ import { Command, Option } from 'clipanion' export abstract class BasePrePublishCommand extends Command { - static paths = [['pre-publish']] + static paths = [['pre-publish, prepublish']] static usage = Command.Usage({ description: