-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5164 from ruibaby/refactor/load-core-modules
refactor: simplify the logic of importing module
- Loading branch information
Showing
5 changed files
with
35 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,10 @@ | ||
// fixme: add supports for auto import | ||
import dashboardModule from "./dashboard/module"; | ||
import postModule from "./contents/posts/module"; | ||
import pageModule from "./contents/pages/module"; | ||
import commentModule from "./contents/comments/module"; | ||
import attachmentModule from "./contents/attachments/module"; | ||
import themeModule from "./interface/themes/module"; | ||
import menuModule from "./interface/menus/module"; | ||
import pluginModule from "./system/plugins/module"; | ||
import userModule from "./system/users/module"; | ||
import roleModule from "./system/roles/module"; | ||
import settingModule from "./system/settings/module"; | ||
import actuatorModule from "./system/actuator/module"; | ||
import authProviderModule from "./system/auth-providers/module"; | ||
import backupModule from "./system/backup/module"; | ||
import type { PluginModule } from "@halo-dev/console-shared"; | ||
|
||
// const coreModules = [ | ||
// dashboardModule, | ||
// postModule, | ||
// pageModule, | ||
// commentModule, | ||
// attachmentModule, | ||
// themeModule, | ||
// menuModule, | ||
// pluginModule, | ||
// userModule, | ||
// roleModule, | ||
// settingModule, | ||
// ]; | ||
const modules = Object.values( | ||
import.meta.glob("./**/module.ts", { | ||
eager: true, | ||
import: "default", | ||
}) | ||
) as PluginModule[]; | ||
|
||
const coreModules = [ | ||
postModule, | ||
pluginModule, | ||
settingModule, | ||
actuatorModule, | ||
dashboardModule, | ||
menuModule, | ||
commentModule, | ||
attachmentModule, | ||
pageModule, | ||
themeModule, | ||
userModule, | ||
roleModule, | ||
authProviderModule, | ||
backupModule, | ||
]; | ||
|
||
export { coreModules }; | ||
export default modules; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters