import { boot } from 'quasar/wrappers'; import { RouteConfig } from 'vue-router'; import { Module } from 'vuex'; interface PluginRouteConfig extends RouteConfig { example?: unknown; } interface EssentialLink { title: string; link: string; icon?: string; } interface Plugin { router: PluginRouteConfig[]; store?: Module; mainLink: PluginMainLink; } interface PluginMainLink extends PluginChildLink { children: PluginChildLink[] | []; } interface PluginChildLink { name: string; title: string; link: string; icon: string; } export { PluginRouteConfig, Plugin, PluginChildLink, PluginMainLink }; // "async" is optional; // more info on params: https://quasar.dev/quasar-cli/cli-documentation/boot-files#Anatomy-of-a-boot-file export default boot(({ Vue, router }) => { const plugins = require.context('src/plugins', true, /.+\/plugin.ts$/); const pluginMainLinks: PluginMainLink[] = []; plugins.keys().forEach((fileName: string) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access router.addRoutes(plugins(fileName).default.router); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access pluginMainLinks.push(plugins(fileName).default.mainLink); }); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access Vue.prototype.$flaschengeist_plugins = pluginMainLinks; console.log(plugins); });