Skip to content

Commit

Permalink
fix: import path and extension
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Dec 11, 2024
1 parent 73f9e10 commit 39ed179
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
38 changes: 33 additions & 5 deletions module/kongponents.nuxt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineNuxtModule, createResolver, addComponentsDir } from '@nuxt/kit'
import { defineNuxtModule, createResolver, addComponentsDir, useLogger /*, addComponent */ } from '@nuxt/kit'
// import { kebabCase, pascalCase } from 'scule'

export interface ModuleOptions {
// Define module options here as needed
Expand All @@ -10,16 +11,43 @@ export default defineNuxtModule<ModuleOptions>({
configKey: 'kongponents',
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
setup(options, nuxt) {
async setup(options, nuxt) {
const resolver = createResolver(import.meta.url)
const logger = useLogger('default-portal-pages')

logger.start('Initializing Kongponents')

// Import all components
// const components = await import(resolver.resolve('../src/components/index.ts'))

// let componentCount = 0

// Loop through the imported components
// Object.entries(components).forEach(([name, component]: [string, any]) => {
// if (component) {
// addComponent({
// name,
// filePath: component, // The file path of the component
// global: true,
// kebabName: kebabCase(name),
// pascalName: pascalCase(name),
// })
// // Increment component count
// componentCount++
// }
// })

// logger.success(`Globally registered ${componentCount} components`)

addComponentsDir({
path: resolver.resolve('../src/components'),
path: resolver.resolve('../src/components/'),
extensions: ['vue'],
pattern: '**/*.vue',
pathPrefix: false,
prefix: '',
global: true,
})

logger.success('Globally registered all Kongponents')
},
})

// export * from './types'
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"focus-trap": "^7.6.0",
"focus-trap-vue": "^4.0.3",
"nanoid": "^5.0.7",
"scule": "^1.3.0",
"sortablejs": "^1.15.3",
"swrv": "^1.0.4",
"v-calendar": "^3.1.2",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 39ed179

Please sign in to comment.