library_components/modules/module.ts
2024-07-09 11:00:50 +02:00

99 lines
1.9 KiB
TypeScript

import {
defineNuxtModule,
createResolver,
addComponent,
addImports,
} from "@nuxt/kit";
import { join } from 'pathe';
export interface ModuleOptions {}
const components = [
{
name: "MlButton",
path: "./components/Ml/Button/MlButton.vue",
},
{
name: "MlPaginator",
path: "./components/Ml/Paginator/MlPaginator.vue",
},
{
name: "MlDropDown",
path: "./components/Ml/DropDown/MlDropDown.vue",
},
{
name: "MlDropDownItem",
path: "./components/Ml/DropDown/MlDropDownItem.vue",
},
{
name: "MlSlider",
path: "./components/Ml/Slider/MlSlider.vue",
},
{
name: "MlSliderPoint",
path: "./components/Ml/SliderPoint/MlSliderPoint.vue",
},
{
name: "MlTabberBase",
path: "./components/Ml/Tabber/MlTabberBase.vue",
},
{
name: "MyComponent",
path: "./components/MyComponent",
},
];
const composables = [
{
name: "useRipple",
path: "./composables/useRipple.ts",
},
{
name: "useMergeClasses",
path: "./composables/useMergeClasses.ts",
},
{
name: "useBounce",
path: "./composables/useBounce.ts",
},
{
name: "useTailwindConf",
path: "./composables/useTailwindConf.ts",
},
];
export default defineNuxtModule<ModuleOptions>({
// meta: {
// name: "module",
// configKey: "myModule",
// },
// defaults: {},
// setup(_options, _nuxt) {
// const resolver = createResolver(import.meta.url);
// for (let item of components) {
// addComponent({
// name: item.name,
// filePath: resolver.resolve(item.path),
// });
// }
// for (let item of composables) {
// addImports([
// {
// name: item.name,
// from: resolver.resolve(item.path),
// },
// ]);
// }
// },
hooks: {
"components:dirs"(dirs) {
dirs.push({
path: join(__dirname, "components"),
});
},
},
});