mirror of
https://github.com/certd/certd.git
synced 2026-04-14 20:40:53 +08:00
17 lines
595 B
TypeScript
17 lines
595 B
TypeScript
import { createRegistry, OnRegisterContext } from "../registry/index.js";
|
|
import { AbstractTaskPlugin } from "./api.js";
|
|
import { pluginGroups } from "./group.js";
|
|
|
|
const onRegister = ({ key, value }: OnRegisterContext<AbstractTaskPlugin>) => {
|
|
const group = value?.define?.group as string;
|
|
if (group) {
|
|
if (pluginGroups.hasOwnProperty(group)) {
|
|
// @ts-ignore
|
|
pluginGroups[group].plugins.push(value.define);
|
|
} else {
|
|
pluginGroups.other.plugins.push(value.define);
|
|
}
|
|
}
|
|
};
|
|
export const pluginRegistry = createRegistry<AbstractTaskPlugin>("plugin", onRegister);
|