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 {
|
export interface CommandSchema {
|
||||||
name: string
|
name: string
|
||||||
|
alias?: string[]
|
||||||
description: string
|
description: string
|
||||||
args: ArgSchema[]
|
args: ArgSchema[]
|
||||||
options: OptionSchema[]
|
options: OptionSchema[]
|
||||||
|
@ -500,6 +501,8 @@ const PRE_PUBLISH_OPTIONS: CommandSchema = {
|
||||||
name: 'prePublish',
|
name: 'prePublish',
|
||||||
description: 'Update package.json and copy addons into per platform packages',
|
description: 'Update package.json and copy addons into per platform packages',
|
||||||
args: [],
|
args: [],
|
||||||
|
// compatible with old command name
|
||||||
|
alias: ['prepublish'],
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'cwd',
|
name: 'cwd',
|
||||||
|
|
|
@ -85,9 +85,16 @@ function generateCommandDef(command: CommandSchema) {
|
||||||
const prepare: string[] = []
|
const prepare: string[] = []
|
||||||
const cmdLines: string[] = []
|
const cmdLines: string[] = []
|
||||||
|
|
||||||
|
let paths = `[['${commandPath}']]`
|
||||||
|
|
||||||
|
if (command.alias) {
|
||||||
|
command.alias.unshift(commandPath)
|
||||||
|
paths = `[['${command.alias.join(', ')}']]`
|
||||||
|
}
|
||||||
|
|
||||||
cmdLines.push(`
|
cmdLines.push(`
|
||||||
export abstract class Base${PascalCase(command.name)}Command extends Command {
|
export abstract class Base${PascalCase(command.name)}Command extends Command {
|
||||||
static paths = [['${commandPath}']]
|
static paths = ${paths}
|
||||||
|
|
||||||
static usage = Command.Usage({
|
static usage = Command.Usage({
|
||||||
description: '${command.description}',
|
description: '${command.description}',
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { Command, Option } from 'clipanion'
|
import { Command, Option } from 'clipanion'
|
||||||
|
|
||||||
export abstract class BasePrePublishCommand extends Command {
|
export abstract class BasePrePublishCommand extends Command {
|
||||||
static paths = [['pre-publish']]
|
static paths = [['pre-publish, prepublish']]
|
||||||
|
|
||||||
static usage = Command.Usage({
|
static usage = Command.Usage({
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in a new issue