Skip to Content
🎉 Hyperse Wizard has been published.

Plugin

The Plugin System provides a modular architecture that allows the Wizard framework to be extended with additional functionality through dynamically loaded plugins.

DefinePlugin

Parameters:
NameTypeDefault
pluginPlugin<CommandMapping, Result, GlobalFlags>

The plugin to define.

Returns:
Plugin<CommandMapping, Result, GlobalFlags>

Plugin

NameTypeDefault
nameLocaleMessageResolver

The name of the plugin.

localeMessagesDeepPartial<{ en: PluginLocaleMessages; zh: PluginLocaleMessages; }>

The locale messages provided by the plugin.

setup(cli: Wizard<NameToContext, GlobalFlags>, ctx: PluginContext) => Wizard<Result, GlobalFlags>

The setup method of the plugin. This function is called when the plugin is registered with the Wizard instance. It receives the current Wizard instance and the plugin context, and should return a (possibly extended) Wizard instance.

Advanced Usage

To seperate handlers from the plugin definition, you can use the definePlugin utility function:

definePlugin.ts
import { definePlugin } from '@hyperse/wizard'; const deployPlugin = definePlugin({ name: 'deploy plugin', localeMessages: helpMessages, setup: (wizard, pluginCtx) => { return wizard; }, });
Last updated on