mirror of https://github.com/halo-dev/halo-admin
feat: use definePlugin function to define a plugin object
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/583/head
parent
8bc6ff798e
commit
515ec78842
|
@ -0,0 +1,5 @@
|
|||
import type { Plugin } from "@/types/plugin";
|
||||
|
||||
export function definePlugin(plugin: Plugin): Plugin {
|
||||
return plugin;
|
||||
}
|
|
@ -1,2 +1,3 @@
|
|||
export * from "./types/plugin";
|
||||
export * from "./types/menus";
|
||||
export * from "./core/plugins";
|
||||
|
|
|
@ -50,7 +50,7 @@ async function registerModule(pluginModule: Plugin) {
|
|||
}
|
||||
|
||||
function loadCoreModules() {
|
||||
[
|
||||
Array.from<Plugin>([
|
||||
dashboardModule,
|
||||
postModule,
|
||||
sheetModule,
|
||||
|
@ -62,7 +62,7 @@ function loadCoreModules() {
|
|||
userModule,
|
||||
roleModule,
|
||||
settingModule,
|
||||
].forEach(registerModule);
|
||||
]).forEach(registerModule);
|
||||
}
|
||||
|
||||
function loadPluginModules() {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout } from "@/layouts";
|
||||
import AttachmentList from "./AttachmentList.vue";
|
||||
import { IconFolder } from "@halo-dev/components";
|
||||
|
||||
const attachmentModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "attachmentModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -31,6 +31,4 @@ const attachmentModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default attachmentModule;
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout } from "@/layouts";
|
||||
import { IconMessage } from "@halo-dev/components";
|
||||
import CommentList from "./CommentList.vue";
|
||||
|
||||
const commentModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "commentModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -31,6 +31,4 @@ const commentModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default commentModule;
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout, BlankLayout } from "@/layouts";
|
||||
import { IconBookRead } from "@halo-dev/components";
|
||||
import PostList from "./PostList.vue";
|
||||
|
@ -6,7 +6,7 @@ import PostEditor from "./PostEditor.vue";
|
|||
import CategoryList from "./categories/CategoryList.vue";
|
||||
import TagList from "./tags/TagList.vue";
|
||||
|
||||
const postModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "postModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -61,6 +61,4 @@ const postModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default postModule;
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout } from "@/layouts";
|
||||
import SheetList from "./SheetList.vue";
|
||||
import { IconPages } from "@halo-dev/components";
|
||||
|
||||
const sheetModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "sheetModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -31,6 +31,4 @@ const sheetModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default sheetModule;
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout } from "@/layouts";
|
||||
import Dashboard from "./Dashboard.vue";
|
||||
import { IconDashboard } from "@halo-dev/components";
|
||||
|
@ -12,7 +12,7 @@ import RecentPublishedWidget from "./widgets/RecentPublishedWidget.vue";
|
|||
import UserStatsWidget from "./widgets/UserStatsWidget.vue";
|
||||
import ViewsStatsWidget from "./widgets/ViewsStatsWidget.vue";
|
||||
|
||||
const dashboardModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "dashboardModule",
|
||||
components: [
|
||||
CommentStatsWidget,
|
||||
|
@ -50,6 +50,4 @@ const dashboardModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default dashboardModule;
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout } from "@/layouts";
|
||||
import MenuList from "./MenuList.vue";
|
||||
import { IconListSettings } from "@halo-dev/components";
|
||||
|
||||
const menuModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "menuModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -31,6 +31,4 @@ const menuModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default menuModule;
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout, BlankLayout } from "@/layouts";
|
||||
import ThemeDetail from "./ThemeDetail.vue";
|
||||
import Visual from "./Visual.vue";
|
||||
import { IconPalette } from "@halo-dev/components";
|
||||
|
||||
const themeModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "themeModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -43,6 +43,4 @@ const themeModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default themeModule;
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout } from "@/layouts";
|
||||
import PluginList from "./PluginList.vue";
|
||||
import PluginDetail from "./PluginDetail.vue";
|
||||
import { IconPlug } from "@halo-dev/components";
|
||||
|
||||
const pluginModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "pluginModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -37,6 +37,4 @@ const pluginModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default pluginModule;
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout } from "@/layouts";
|
||||
import RoleList from "./RoleList.vue";
|
||||
import RoleDetail from "./RoleDetail.vue";
|
||||
|
||||
const roleModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "roleModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -25,6 +25,4 @@ const roleModule: Plugin = {
|
|||
},
|
||||
],
|
||||
menus: [],
|
||||
};
|
||||
|
||||
export default roleModule;
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { SystemSettingsLayout } from "@/layouts";
|
||||
import GeneralSettings from "./GeneralSettings.vue";
|
||||
import NotificationSettings from "./NotificationSettings.vue";
|
||||
import { IconSettings } from "@halo-dev/components";
|
||||
|
||||
const settingModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "settingModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -38,6 +38,4 @@ const settingModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default settingModule;
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Plugin } from "@halo-dev/admin-shared";
|
||||
import { definePlugin } from "@halo-dev/admin-shared";
|
||||
import { BasicLayout, BlankLayout, UserProfileLayout } from "@/layouts";
|
||||
import UserList from "./UserList.vue";
|
||||
import UserDetail from "./UserDetail.vue";
|
||||
|
@ -7,7 +7,7 @@ import PasswordChange from "./PasswordChange.vue";
|
|||
import PersonalAccessTokens from "./PersonalAccessTokens.vue";
|
||||
import { IconUserSettings } from "@halo-dev/components";
|
||||
|
||||
const userModule: Plugin = {
|
||||
export default definePlugin({
|
||||
name: "userModule",
|
||||
components: [],
|
||||
routes: [
|
||||
|
@ -68,6 +68,4 @@ const userModule: Plugin = {
|
|||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default userModule;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue