Skip to content

Commit

Permalink
refactor: prepare for Nuxt v4
Browse files Browse the repository at this point in the history
  • Loading branch information
SegaraRai committed Jul 16, 2024
1 parent 2c83a71 commit cdcb9ad
Show file tree
Hide file tree
Showing 57 changed files with 1,847 additions and 2,050 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Luonto をホストしているサーバー (Cloudflare Pages) は静的アセ
以下が必要です

- [Node.js](https://nodejs.org/) v20
- [pnpm](https://pnpm.io/) v8
- [pnpm](https://pnpm.io/) v9

[Bun](https://bun.sh/) が正式に Windows に対応したら pnpm から移行するかも

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<script setup lang="ts">
import type { H3Error } from "h3";
import type { RateLimit } from "~/server/utils/rateLimit";
import type { RateLimit } from "~~/server/utils/rateLimit";
const props = defineProps<{ error: H3Error; onHandleError: () => void }>();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RateLimit } from "~/server/utils/rateLimit";
import type { RateLimit } from "~~/server/utils/rateLimit";

export function useHandleSignalSendPromise(): (
promise: Promise<unknown>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const nitro =

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: "2024-07-16",
future: {
compatibilityVersion: 4,
},
devtools: { enabled: true },
modules: [
"@nuxt/eslint",
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"@auth/core": "^0.34.1",
"@hebilicious/authjs-nuxt": "^0.3.5",
"@iconify-json/material-symbols": "^1.1.82",
"@iconify-json/material-symbols": "^1.1.84",
"@iconify-json/mdi": "^1.1.67",
"@iconify-json/mingcute": "^1.1.18",
"@iconify-json/ph": "^1.1.13",
Expand All @@ -31,31 +31,31 @@
"@vue/test-utils": "^2.4.6",
"@vueuse/nuxt": "^10.11.0",
"defu": "^6.1.4",
"eslint": "^9.6.0",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-define-config": "^2.1.0",
"fast-glob": "^3.3.2",
"happy-dom": "^14.12.3",
"idb-keyval": "^6.2.1",
"lru-cache": "^10.3.0",
"lru-cache": "^11.0.0",
"mime-types": "^2.1.35",
"nuxt": "^3.12.2",
"prettier": "^3.3.2",
"prettier-plugin-organize-imports": "^3.2.4",
"nuxt": "^3.12.3",
"prettier": "^3.3.3",
"prettier-plugin-organize-imports": "^4.0.0",
"serve": "^14.2.3",
"svgo": "^3.3.2",
"taze": "^0.13.9",
"tsx": "^4.16.0",
"typescript": "^5.5.2",
"valibot": "^0.35.0",
"vitest": "^1.6.0",
"taze": "^0.15.2",
"tsx": "^4.16.2",
"typescript": "^5.5.3",
"valibot": "^0.36.0",
"vitest": "^2.0.3",
"vue": "^3.4.31",
"vue-router": "^4.4.0",
"vue-tsc": "^2.0.24",
"vue-tsc": "^2.0.26",
"workbox-build": "^7.1.1",
"workbox-precaching": "^7.1.0",
"workbox-routing": "^7.1.0",
"workbox-strategies": "^7.1.0",
"wrangler": "^3.62.0"
"wrangler": "^3.64.0"
}
}
3,817 changes: 1,805 additions & 2,012 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions server/api/auth/[...].ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { NuxtAuthHandler } from "#auth";
import Credentials from "@auth/core/providers/credentials";
import type { AuthConfig, User } from "@auth/core/types";
import { clearAnonymizeDetailStorage } from "~/server/utils/anonymizeDetailCache";
import { clearNatureAPICacheStorage } from "~/server/utils/natureAPICache";
import { clearRateLimitCacheStorage } from "~/server/utils/rateLimitCache";
import type { SessionUserData } from "~/server/utils/session";
import { clearCookieStorage } from "~/server/utils/swCookieStorage";
import { clearAnonymizeDetailStorage } from "~~/server/utils/anonymizeDetailCache";
import { clearNatureAPICacheStorage } from "~~/server/utils/natureAPICache";
import { clearRateLimitCacheStorage } from "~~/server/utils/rateLimitCache";
import type { SessionUserData } from "~~/server/utils/session";
import { clearCookieStorage } from "~~/server/utils/swCookieStorage";

const runtimeConfig = useRuntimeConfig();

Expand Down
2 changes: 1 addition & 1 deletion server/api/bff/appliances/[id].get.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchNatureAPIs } from "~/server/utils/fetchNatureAPIs";
import { fetchNatureAPIs } from "~~/server/utils/fetchNatureAPIs";

export default defineSWEventHandler(async (event) => {
const id = getRouterParam(event, "id");
Expand Down
2 changes: 1 addition & 1 deletion server/api/bff/devices/[id].get.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchNatureAPIs } from "~/server/utils/fetchNatureAPIs";
import { fetchNatureAPIs } from "~~/server/utils/fetchNatureAPIs";

export default defineSWEventHandler(async (event) => {
const id = getRouterParam(event, "id");
Expand Down
2 changes: 1 addition & 1 deletion server/api/bff/home.get.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchNatureAPIs } from "~/server/utils/fetchNatureAPIs";
import { fetchNatureAPIs } from "~~/server/utils/fetchNatureAPIs";

export default defineSWEventHandler(async (event) => {
const { appliances, devices, $cacheStatus } = await fetchNatureAPIs(event, [
Expand Down
10 changes: 5 additions & 5 deletions server/api/nature/[...].ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { collectAnonymizeDetailDataFromResponse } from "~/server/utils/anonymizeDetailCache";
import { collectAnonymizeDetailDataFromResponse } from "~~/server/utils/anonymizeDetailCache";
import {
CACHE_SWR_MAX_AGE_RESPONSE_CACHE_ERROR,
CACHE_SWR_MAX_AGE_RESPONSE_CACHE_SUCCESSFUL,
} from "~/server/utils/constants";
} from "~~/server/utils/constants";
import {
createNatureAPIRequestHeaderInit,
natureAPICache,
persistNatureAPICache,
restoreNatureAPICacheOnce,
} from "~/server/utils/natureAPICache";
import { createRateLimitFromHeaders } from "~/server/utils/rateLimit";
import { setRateLimitCache } from "~/server/utils/rateLimitCache";
} from "~~/server/utils/natureAPICache";
import { createRateLimitFromHeaders } from "~~/server/utils/rateLimit";
import { setRateLimitCache } from "~~/server/utils/rateLimitCache";

export default defineSWEventHandler(async (event): Promise<Response> => {
const user = await getAuthSessionUserData(event);
Expand Down
2 changes: 1 addition & 1 deletion server/api/session.get.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getRateLimitCache } from "~/server/utils/rateLimitCache";
import { getRateLimitCache } from "~~/server/utils/rateLimitCache";

export default defineSWEventHandler(async (event) => {
const user = await getAuthSessionUserData(event);
Expand Down
14 changes: 7 additions & 7 deletions server/utils/natureAPICache.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { LRUCache } from "lru-cache";
import { collectAnonymizeDetailDataFromResponse } from "~/server/utils/anonymizeDetailCache";
import { collectAnonymizeDetailDataFromResponse } from "~~/server/utils/anonymizeDetailCache";
import {
CACHE_MAX_RESPONSE_CACHE,
CACHE_TTL_RESPONSE_CACHE,
STORAGE_KEY_NATURE_API_CACHE,
} from "~/server/utils/constants";
import { createOnce } from "~/server/utils/once";
import { createRateLimitFromHeaders } from "~/server/utils/rateLimit";
import { setRateLimitCache } from "~/server/utils/rateLimitCache";
import { createSerial } from "~/server/utils/serial";
} from "~~/server/utils/constants";
import { createOnce } from "~~/server/utils/once";
import { createRateLimitFromHeaders } from "~~/server/utils/rateLimit";
import { setRateLimitCache } from "~~/server/utils/rateLimitCache";
import { createSerial } from "~~/server/utils/serial";
import {
loadServerStorage,
storeServerStorage,
} from "~/server/utils/serverStorage";
} from "~~/server/utils/serverStorage";

export function createNatureAPIRequestHeaderInit(token: string): HeadersInit {
return {
Expand Down
2 changes: 1 addition & 1 deletion server/utils/session.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getServerSession } from "#auth";
import type { Session } from "@auth/core/types";
import type { H3Event } from "h3";
import { authOptions } from "~/server/api/auth/[...]";
import { authOptions } from "~~/server/api/auth/[...]";

export interface SessionUserData {
readonly id: string;
Expand Down

0 comments on commit cdcb9ad

Please sign in to comment.