From 531907ab70ab132fd7d2638e11a95b76d2825f97 Mon Sep 17 00:00:00 2001 From: kevin olson Date: Sun, 19 Jan 2025 19:17:18 -0600 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20back=20to=20ModuleOptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/nuxthub.yml | 37 ----------------------------------- src/runtime/care.ts | 5 +---- src/runtime/nitro.ts | 3 ++- src/runtime/plugin.ts | 3 ++- 4 files changed, 5 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/nuxthub.yml diff --git a/.github/workflows/nuxthub.yml b/.github/workflows/nuxthub.yml deleted file mode 100644 index ae7c530..0000000 --- a/.github/workflows/nuxthub.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Deploy to NuxtHub -on: push - -jobs: - deploy: - name: "Deploy to NuxtHub" - runs-on: ubuntu-latest - environment: - name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }} - url: ${{ steps.deploy.outputs.deployment-url }} - permissions: - contents: read - id-token: write - - steps: - - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Build application - run: pnpm build - - - name: Deploy to NuxtHub - uses: nuxt-hub/action@v1 - id: deploy - with: - project-key: care-0rdx diff --git a/src/runtime/care.ts b/src/runtime/care.ts index 447bfed..9a8d9b8 100644 --- a/src/runtime/care.ts +++ b/src/runtime/care.ts @@ -1,7 +1,4 @@ -interface Config { - apiKey: string - apiDomain?: string -} +import type { ModuleOptions as Config } from '../module' interface ErrorPayload { name: string diff --git a/src/runtime/nitro.ts b/src/runtime/nitro.ts index 92142a8..5757d76 100644 --- a/src/runtime/nitro.ts +++ b/src/runtime/nitro.ts @@ -1,9 +1,10 @@ import { defineNitroPlugin, useRuntimeConfig } from 'nitropack/runtime' +import type { ModuleOptions } from '../module' import { careNitroError } from './care' export default defineNitroPlugin((nitroApp) => { nitroApp.hooks.hook('error', async (error, { event }) => { - const config = useRuntimeConfig(event).public.care as Required<{ apiKey: string, apiDomain?: string }> + const config = useRuntimeConfig(event).public.care as Required careNitroError(error, config) }) }) diff --git a/src/runtime/plugin.ts b/src/runtime/plugin.ts index e2ec190..e68a21e 100644 --- a/src/runtime/plugin.ts +++ b/src/runtime/plugin.ts @@ -1,8 +1,9 @@ +import type { ModuleOptions } from '../module' import { careVueError, careAppError } from './care' import { defineNuxtPlugin, useRuntimeConfig } from '#app' export default defineNuxtPlugin((nuxtApp) => { - const config = useRuntimeConfig().public.care as Required<{ apiKey: string, apiDomain?: string }> + const config = useRuntimeConfig().public.care as Required nuxtApp.hook('vue:error', (error: unknown, _instance, _info) => careVueError(error, config)) nuxtApp.hook('app:error', (error: unknown) => careAppError(error, config)) })