diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 451d26a..7c10160 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -3,8 +3,8 @@ "type": "module", "version": "0.0.0", "packageManager": "pnpm@8.13.0", - "description": "add description", - "author": "add author", + "description": "A tiny, performant animation library for NuxtJS", + "author": "Mehmet productdevbook ", "license": "MIT", "funding": "https://github.com/sponsors/productdevbook", "homepage": "https://github.com/oku-ui/motion", @@ -40,7 +40,7 @@ "dev": "nuxi dev playground", "dev:build": "nuxi build playground", "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground", - "release": "pnpm build && bumpp --commit --push --tag && pnpm publish", + "release": "pnpm build && pnpm bumpp --commit='version(nuxt): release %s' --no-tag && pnpm publish", "lint": "eslint .", "lint:fix": "eslint . --fix", "test": "vitest run", @@ -51,7 +51,8 @@ "vue": ">=3.3.0" }, "dependencies": { - "@nuxt/kit": "^3.9.0" + "@nuxt/kit": "^3.9.0", + "@oku-ui/motion": "latest" }, "devDependencies": { "@nuxt/module-builder": "^0.5.5", diff --git a/packages/nuxt/playground/app.vue b/packages/nuxt/playground/app.vue index a5f2c39..ae4cc5f 100644 --- a/packages/nuxt/playground/app.vue +++ b/packages/nuxt/playground/app.vue @@ -1,8 +1,59 @@ - + + diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index 97acebb..012f0bd 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -1,35 +1,50 @@ -import { addPlugin, createResolver, defineNuxtModule } from '@nuxt/kit' +import { addComponent, defineNuxtModule } from '@nuxt/kit' -// Module options TypeScript interface definition export interface ModuleOptions { - apiKey: string + autoImportComponents?: boolean + prefix?: string } -export interface ModuleHooks { - 'my-module:init': any -} +// export interface ModuleHooks { +// 'my-module:init': any +// } -export interface ModulePublicRuntimeConfig { - NAME: string -} +// export interface ModulePublicRuntimeConfig { +// NAME: string +// } -export interface ModuleRuntimeConfig { - PRIVATE_NAME: string -} +// export interface ModuleRuntimeConfig { +// PRIVATE_NAME: string +// } + +const motionComponents = [ + 'Motion', + 'Presence', + 'PresenceGroup', +] export default defineNuxtModule({ meta: { - name: 'my-module', - configKey: 'myModule', + name: '@oku-ui/motion-nuxt', + configKey: 'motion', }, - // Default configuration options of the Nuxt module defaults: { - apiKey: '', + autoImportComponents: true, }, - setup(_options, _nuxt) { - const resolver = createResolver(import.meta.url) + setup(options, _nuxt) { + // const resolver = createResolver(import.meta.url) + + if (options.autoImportComponents) { + motionComponents.forEach((component) => { + addComponent({ + name: `${options.prefix}${component}`, + export: component, + filePath: '@oku-ui/motion', + }) + }) + } // Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack` - addPlugin(resolver.resolve('./runtime/plugin')) + // addPlugin(resolver.resolve('./runtime/plugin')) }, }) diff --git a/packages/vue/package.json b/packages/vue/package.json index edfab1c..0915231 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -7,12 +7,12 @@ "author": "Mehmet productdevbook ", "license": "MIT", "funding": "https://github.com/sponsors/productdevbook", - "homepage": "https://github.com/productdevbookcom/@oku-ui/motion", + "homepage": "https://github.com/oku/oku-ui/motion", "repository": { "type": "git", - "url": "https://github.com/productdevbookcom/@oku-ui/motion.git" + "url": "https://github.com/oku/oku-ui/motion.git" }, - "bugs": "https://github.com/productdevbookcom/@oku-ui/motion/issues", + "bugs": "https://github.com/oku/oku-ui/motion/issues", "keywords": [ "vue", "motion" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4dbb945..708fdbc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,6 +68,9 @@ importers: '@nuxt/kit': specifier: ^3.9.0 version: 3.9.0(rollup@3.29.4) + '@oku-ui/motion': + specifier: latest + version: link:../vue devDependencies: '@nuxt/module-builder': specifier: ^0.5.5