From 5a1b28fc438fa204d494fbcc5059396b2647e442 Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Thu, 31 Aug 2023 00:33:32 +0900 Subject: [PATCH] fix: export fetch directly --- apps/auto-run-ac/src/handlers/fetch.ts | 3 +-- apps/auto-run-ac/src/handlers/scheduled.ts | 4 ++-- apps/auto-run-ac/src/lib/handler.ts | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/auto-run-ac/src/handlers/fetch.ts b/apps/auto-run-ac/src/handlers/fetch.ts index 7962766..7e290bd 100644 --- a/apps/auto-run-ac/src/handlers/fetch.ts +++ b/apps/auto-run-ac/src/handlers/fetch.ts @@ -8,7 +8,6 @@ import { serveStatic } from 'hono/cloudflare-workers'; import * as build from 'switchbot-web/build'; import __STATIC_CONTENT_MANIFEST from '__STATIC_CONTENT_MANIFEST'; import { initSentry, isProduction } from 'shared'; -import type { RequiredHandlers } from '@/lib/handler'; const assetManifest = JSON.parse(__STATIC_CONTENT_MANIFEST); let handleRemixRequest: ReturnType; @@ -78,4 +77,4 @@ app.get('*', async (ctx) => { } }); -export const fetch: RequiredHandlers['fetch'] = (req) => app.fetch(req); +export const { fetch } = app; diff --git a/apps/auto-run-ac/src/handlers/scheduled.ts b/apps/auto-run-ac/src/handlers/scheduled.ts index 628a1c6..1f541a2 100644 --- a/apps/auto-run-ac/src/handlers/scheduled.ts +++ b/apps/auto-run-ac/src/handlers/scheduled.ts @@ -5,7 +5,7 @@ import { notifyAirConditionerOnToDiscord } from '@/lib/discord'; import { filterValidTrigger } from '@/lib/trigger'; import { isHoliday } from '@holiday-jp/holiday_jp'; import { utcToZonedTime } from 'date-fns-tz'; -import type { RequiredHandlers } from '@/lib/handler'; +import type { Handlers } from '@/lib/handler'; /** * 与えられた日付において、本プログラムによってエアコンがつけられたかどうかを返す @@ -15,7 +15,7 @@ import type { RequiredHandlers } from '@/lib/handler'; */ const isAlreadyTurnedOnToday = async (date: string, kv: KVNamespace) => kv.get(date).then((v) => !!v); -export const scheduled: RequiredHandlers['scheduled'] = async (_event, env, ctx) => { +export const scheduled: Required['scheduled'] = async (_event, env, ctx) => { const sentry = initSentry(env.SENTRY_DSN, env.SENTRY_CLIENT_ID, env.SENTRY_CLIENT_SECRET, ctx); try { diff --git a/apps/auto-run-ac/src/lib/handler.ts b/apps/auto-run-ac/src/lib/handler.ts index c4ea9d3..b54728c 100644 --- a/apps/auto-run-ac/src/lib/handler.ts +++ b/apps/auto-run-ac/src/lib/handler.ts @@ -1,2 +1 @@ export type Handlers = ExportedHandler; -export type RequiredHandlers = Required;