Skip to content

Commit

Permalink
Removed reference to commander in a regular (non-CLI) package usage
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Oct 25, 2024
1 parent 4004ba0 commit 97fee64
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 deletions.
44 changes: 22 additions & 22 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/packages/emmett-postgresql/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import type { EmmettCliPlugin } from '@event-driven-io/emmett';
import type {
EmmettCliCommand,
EmmettCliPlugin,
} from '@event-driven-io/emmett';
import { migrateCommand } from './commandLine';

const cli: EmmettCliPlugin = {
pluginType: 'cli',
name: 'emmett-postgresql',
registerCommands: (program) => {
registerCommands: (program: EmmettCliCommand) => {
program.addCommand(migrateCommand);
},
};
Expand Down
3 changes: 2 additions & 1 deletion src/packages/emmett/src/commandLine/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Command as CliCommand } from 'commander';
import path from 'path';
import {
isPluginConfig,
type EmmettCliCommand,
type EmmettCliPlugin,
type EmmettPlugin,
type EmmettPluginConfig,
Expand Down Expand Up @@ -117,7 +118,7 @@ export const registerCliPlugins = async (
if (!('registerCommands' in plugin)) {
console.warn(`No registerCommands function found in ${pluginName}`);
}
await plugin.registerCommands(program);
await plugin.registerCommands(program as EmmettCliCommand);
console.log(`Loaded extension: ${plugin.name}`);
result.push(plugin);
}
Expand Down
8 changes: 5 additions & 3 deletions src/packages/emmett/src/config/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Command as CliCommand } from 'commander';

export type EmmettPluginConfig =
| {
name: string;
Expand All @@ -13,10 +11,14 @@ export type EmmettCliPluginRegistration = { pluginType: 'cli'; path?: string };

export type EmmettPluginRegistration = EmmettCliPluginRegistration;

export type EmmettCliCommand = {
addCommand<CliCommand>(command: CliCommand): CliCommand;
};

export type EmmettCliPlugin = {
pluginType: 'cli';
name: string;
registerCommands: (program: CliCommand) => Promise<void> | void;
registerCommands: (program: EmmettCliCommand) => Promise<void> | void;
};

export type EmmettPlugin = EmmettCliPlugin;
Expand Down

0 comments on commit 97fee64

Please sign in to comment.