@cirrusct/mr-command
TypeScript icon, indicating that this package has built-in type declarations

1.0.124 • Public • Published

Command

The command system is completely extensible with Command handlers that conform to defined interfaces and are registered with mr-core when mr is initialized.

Command Handlers

Command handlers are exposed by a package with Command Manifests that define the handlers for a particular command.

A Manifest defines 2 types of handlers, each defining a map keyed on the name of the command:

export interface MrCommandManifest {
    packageHandlers?: { [name: string]: MrPackageCommandHandler };
    commandHandlers?: { [name: string]: MrCommandHandler };
}

MrPackageCommandHandler

A MrPackageCommandHandler defines a command the operates on a single package in the monorepo. Depending on cli options, the handler may be called separately for multiple packages, but the handler itself only executes for a single package.

export type MrPackageCommandHandler = <TOptions extends MrCommandOptions>(
    mrPackage: MonoRepoPackage,
    options: TOptions,
    buildConfig: BuildConfig,
    logger: Logger
) => Promise<void>;

MrCommandHandler

A MrCommandHandler defines a command that operates on the monorepo generally.

export interface MrCommandHandlerArgs<TOptions extends MrCommandOptions> {
    monoRepo: MonoRepo;
    packages: MonoRepoPackage[];
    cwd: string;
    entryPackage: MonoRepoPackage | null;
    options: TOptions;
    logger: Logger;
}

export type MrCommandHandler<TOptions extends MrCommandOptions = {}> = (
    args: MrCommandHandlerArgs<TOptions>
) => Promise<void>;

Readme

Keywords

none

Package Sidebar

Install

npm i @cirrusct/mr-command

Weekly Downloads

0

Version

1.0.124

License

MIT

Unpacked Size

103 kB

Total Files

186

Last publish

Collaborators

  • cirrusct