fix(cli): make prepublish as pre-publish alias (#1861)
This commit is contained in:
parent
c7189a68c2
commit
2b7a6348f6
3 changed files with 12 additions and 2 deletions
|
@ -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',
|
||||
|
|
|
@ -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}',
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue