2021-07-26 14:04:35 +00:00
|
|
|
import type { Argv } from 'mri'
|
|
|
|
|
2021-10-02 16:01:17 +00:00
|
|
|
const _rDefault = r => r.default || r
|
|
|
|
|
2021-04-09 15:52:45 +00:00
|
|
|
export const commands = {
|
2021-10-02 16:01:17 +00:00
|
|
|
dev: () => import('./dev').then(_rDefault),
|
|
|
|
build: () => import('./build').then(_rDefault),
|
|
|
|
prepare: () => import('./prepare').then(_rDefault),
|
|
|
|
usage: () => import('./usage').then(_rDefault),
|
2021-10-05 20:35:23 +00:00
|
|
|
info: () => import('./info').then(_rDefault),
|
|
|
|
init: () => import('./init').then(_rDefault),
|
|
|
|
create: () => import('./init').then(_rDefault)
|
2021-04-09 15:52:45 +00:00
|
|
|
}
|
2021-07-26 14:04:35 +00:00
|
|
|
|
|
|
|
export type Command = keyof typeof commands
|
|
|
|
|
|
|
|
export interface NuxtCommandMeta {
|
|
|
|
name: string;
|
|
|
|
usage: string;
|
|
|
|
description: string;
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface NuxtCommand {
|
|
|
|
invoke(args: Argv): Promise<void> | void
|
|
|
|
meta: NuxtCommandMeta
|
|
|
|
}
|
|
|
|
|
|
|
|
export function defineNuxtCommand (command: NuxtCommand): NuxtCommand {
|
|
|
|
return command
|
|
|
|
}
|