Legacy Plugin
The Legacy plugin for CommandKit enables support for legacy command and event handlers. This is particularly useful when migrating from an older version of CommandKit or another framework, as it allows you to incrementally upgrade your application without requiring immediate major changes to your existing code.
Installation
- npm
- yarn
- pnpm
npm install @commandkit/legacy
yarn add @commandkit/legacy
pnpm add @commandkit/legacy
Usage
Add the Legacy plugin to your CommandKit configuration:
import { defineConfig } from 'commandkit';
import { legacy } from '@commandkit/legacy';
export default defineConfig({
plugins: [legacy()],
});
Features
The Legacy plugin provides the following features:
-
Legacy Command Handler Support: Enables support for older command handler formats, making migration easier.
-
Legacy Event Handler Support: Allows you to continue using your existing event handler structure.
-
Legacy Validation Support: Maintains compatibility with existing validation methods.
-
Hot Module Replacement (HMR): The plugin automatically enables HMR for legacy commands, events, and validations, improving the development experience by allowing you to see changes without restarting your bot.
Migration Strategy
The Legacy plugin is designed as a transitional tool. While it allows you to continue using your existing code structure, it's recommended to gradually migrate your commands, events, and validators to the new CommandKit format over time.
This approach enables you to:
- Upgrade your bot's framework immediately without breaking existing functionality
- Incrementally refactor your code at your own pace
- Take advantage of new CommandKit features for new commands while maintaining backward compatibility