Nuxt/packages/nuxi/src/commands/index.ts
2021-10-02 18:01:17 +02:00

30 lines
701 B
TypeScript

import type { Argv } from 'mri'
const _rDefault = r => r.default || r
export const commands = {
dev: () => import('./dev').then(_rDefault),
build: () => import('./build').then(_rDefault),
prepare: () => import('./prepare').then(_rDefault),
usage: () => import('./usage').then(_rDefault),
info: () => import('./info').then(_rDefault)
}
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
}