From b8289c3c794b07a0b88bc573c212567725d746df Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 27 Sep 2025 07:49:41 +0300 Subject: [PATCH] chore: migrate to projects + fix type issues --- app/augments.d.ts | 19 +++++++++++++++++++ app/plugins/setup-i18n.ts | 4 ++-- config/i18n.ts | 5 ----- modules/build-env.ts | 2 +- nuxt.config.ts | 20 +------------------- package.json | 8 +++++--- pnpm-lock.yaml | 18 ++++++++++++------ service-worker/tsconfig.json | 3 ++- service-worker/tsconfig.tsbuildinfo | 1 + service-worker/web-push-notifications.ts | 2 +- shared/types/index.ts | 4 +--- tsconfig.json | 19 ++++++++++++++++++- 12 files changed, 63 insertions(+), 42 deletions(-) create mode 100644 app/augments.d.ts create mode 100644 service-worker/tsconfig.tsbuildinfo diff --git a/app/augments.d.ts b/app/augments.d.ts new file mode 100644 index 00000000..e94466b0 --- /dev/null +++ b/app/augments.d.ts @@ -0,0 +1,19 @@ +export {} + +declare module '#app' { + interface PageMeta { + wideLayout?: boolean + } + + interface RuntimeNuxtHooks { + 'elk-logo:click': () => void + } +} + +declare global { + namespace NodeJS { + interface Process { + mock?: Record + } + } +} diff --git a/app/plugins/setup-i18n.ts b/app/plugins/setup-i18n.ts index 9c292159..18c3fbd9 100644 --- a/app/plugins/setup-i18n.ts +++ b/app/plugins/setup-i18n.ts @@ -19,11 +19,11 @@ export default defineNuxtPlugin(async (nuxt) => { if (!supportLanguages.includes(lang.value)) userSettings.value.language = getDefaultLanguage(supportLanguages) - if (lang.value !== i18n.locale) + if (lang.value !== i18n.locale.value) await setLocale(userSettings.value.language as Locale) watch([lang, isHydrated], () => { - if (isHydrated.value && lang.value !== i18n.locale) + if (isHydrated.value && lang.value !== i18n.locale.value) setLocale(lang.value) }, { immediate: true }) } diff --git a/config/i18n.ts b/config/i18n.ts index 66356b47..d76e2559 100644 --- a/config/i18n.ts +++ b/config/i18n.ts @@ -75,13 +75,11 @@ export const countryLocaleVariants: Record - } - } -} - -declare module '#app' { - interface PageMeta { - wideLayout?: boolean - } - - interface RuntimeNuxtHooks { - 'elk-logo:click': () => void - } -} - declare module '@nuxt/schema' { interface AppConfig { storage: any diff --git a/package.json b/package.json index 811c1d34..12823920 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "generate": "nuxt generate", "test:unit": "vitest", "test:unit:ci": "vitest run", - "test:typecheck": "vue-tsc --noEmit && vue-tsc --noEmit --project service-worker/tsconfig.json", + "test:typecheck": "vue-tsc -b --noEmit", "test": "nr test:unit", "test:ci": "nr test:unit:ci", "update:team:avatars": "tsx scripts/avatars.ts", @@ -61,6 +61,7 @@ "@tiptap/suggestion": "2.2.4", "@tiptap/vue-3": "2.2.4", "@unhead/schema": "^2.0.17", + "@unlazy/nuxt": "^0.12.4", "@unocss/nuxt": "^66.5.2", "@upstash/redis": "^1.27.1", "@vercel/kv": "^3.0.0", @@ -71,6 +72,7 @@ "@vueuse/math": "^12.0.0", "@vueuse/motion": "2.2.6", "@vueuse/nuxt": "^13.9.0", + "@vueuse/shared": "^13.9.0", "blurhash": "^2.0.5", "browser-fs-access": "^0.38.0", "cheerio": "^1.0.0", @@ -93,6 +95,7 @@ "masto": "^6.10.4", "mocked-exports": "^0.1.1", "node-emoji": "^2.1.3", + "nuxt": "^4.1.2", "nuxt-security": "^2.4.0", "page-lifecycle": "^0.1.2", "pathe": "^2.0.3", @@ -115,6 +118,7 @@ "unstorage": "^1.17.1", "vite": "^7.1.7", "vite-plugin-pwa": "^0.21.0", + "vue": "^3.5.4", "vue-advanced-cropper": "^2.8.9", "vue-virtual-scroller": "2.0.0-beta.8", "workbox-build": "^7.1.1", @@ -136,7 +140,6 @@ "@types/js-yaml": "^4.0.9", "@types/wicg-file-system-access": "^2023.10.6", "@types/ws": "^8.18.1", - "@unlazy/nuxt": "^0.12.4", "@unocss/eslint-config": "^66.4.2", "@vue/test-utils": "2.4.6", "bumpp": "^10.2.3", @@ -146,7 +149,6 @@ "flat": "^6.0.1", "fs-extra": "^11.3.1", "lint-staged": "^16.1.6", - "nuxt": "^4.1.2", "prettier": "^3.6.2", "sharp": "^0.34.3", "sharp-ico": "^0.1.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b229db7c..cc40ffe6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,6 +99,9 @@ importers: '@unhead/schema': specifier: ^2.0.17 version: 2.0.17 + '@unlazy/nuxt': + specifier: ^0.12.4 + version: 0.12.4(magicast@0.3.5) '@unocss/nuxt': specifier: ^66.5.2 version: 66.5.2(magicast@0.3.5)(postcss@8.5.6)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(lightningcss@1.30.1)(terser@5.44.0)(tsx@4.20.6)(yaml@2.8.1))(webpack@5.101.3(esbuild@0.25.10)) @@ -129,6 +132,9 @@ importers: '@vueuse/nuxt': specifier: ^13.9.0 version: 13.9.0(magicast@0.3.5)(nuxt@4.1.2(@parcel/watcher@2.5.1)(@types/node@24.5.2)(@upstash/redis@1.35.4)(@vercel/kv@3.0.0)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.4.1)(db0@0.3.2(better-sqlite3@12.4.1))(eslint@9.36.0(jiti@2.6.0))(idb-keyval@6.2.2)(ioredis@5.8.0)(lightningcss@1.30.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.52.2)(terser@5.44.0)(tsx@4.20.6)(typescript@5.9.2)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(lightningcss@1.30.1)(terser@5.44.0)(tsx@4.20.6)(yaml@2.8.1))(vue-tsc@2.2.12(typescript@5.9.2))(yaml@2.8.1))(vue@3.5.22(typescript@5.9.2)) + '@vueuse/shared': + specifier: ^13.9.0 + version: 13.9.0(vue@3.5.22(typescript@5.9.2)) blurhash: specifier: ^2.0.5 version: 2.0.5 @@ -195,6 +201,9 @@ importers: node-emoji: specifier: ^2.1.3 version: 2.2.0 + nuxt: + specifier: ^4.1.2 + version: 4.1.2(@parcel/watcher@2.5.1)(@types/node@24.5.2)(@upstash/redis@1.35.4)(@vercel/kv@3.0.0)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.4.1)(db0@0.3.2(better-sqlite3@12.4.1))(eslint@9.36.0(jiti@2.6.0))(idb-keyval@6.2.2)(ioredis@5.8.0)(lightningcss@1.30.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.52.2)(terser@5.44.0)(tsx@4.20.6)(typescript@5.9.2)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(lightningcss@1.30.1)(terser@5.44.0)(tsx@4.20.6)(yaml@2.8.1))(vue-tsc@2.2.12(typescript@5.9.2))(yaml@2.8.1) nuxt-security: specifier: ^2.4.0 version: 2.4.0(magicast@0.3.5)(rollup@4.52.2) @@ -261,6 +270,9 @@ importers: vite-plugin-pwa: specifier: ^0.21.0 version: 0.21.2(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(lightningcss@1.30.1)(terser@5.44.0)(tsx@4.20.6)(yaml@2.8.1))(workbox-build@7.3.0)(workbox-window@7.3.0) + vue: + specifier: ^3.5.4 + version: 3.5.22(typescript@5.9.2) vue-advanced-cropper: specifier: ^2.8.9 version: 2.8.9(vue@3.5.22(typescript@5.9.2)) @@ -319,9 +331,6 @@ importers: '@types/ws': specifier: ^8.18.1 version: 8.18.1 - '@unlazy/nuxt': - specifier: ^0.12.4 - version: 0.12.4(magicast@0.3.5) '@unocss/eslint-config': specifier: ^66.4.2 version: 66.5.2(eslint@9.36.0(jiti@2.6.0))(typescript@5.9.2) @@ -349,9 +358,6 @@ importers: lint-staged: specifier: ^16.1.6 version: 16.2.1 - nuxt: - specifier: ^4.1.2 - version: 4.1.2(@parcel/watcher@2.5.1)(@types/node@24.5.2)(@upstash/redis@1.35.4)(@vercel/kv@3.0.0)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.4.1)(db0@0.3.2(better-sqlite3@12.4.1))(eslint@9.36.0(jiti@2.6.0))(idb-keyval@6.2.2)(ioredis@5.8.0)(lightningcss@1.30.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.52.2)(terser@5.44.0)(tsx@4.20.6)(typescript@5.9.2)(vite@7.1.7(@types/node@24.5.2)(jiti@2.6.0)(lightningcss@1.30.1)(terser@5.44.0)(tsx@4.20.6)(yaml@2.8.1))(vue-tsc@2.2.12(typescript@5.9.2))(yaml@2.8.1) prettier: specifier: ^3.6.2 version: 3.6.2 diff --git a/service-worker/tsconfig.json b/service-worker/tsconfig.json index 98999a50..79498d19 100644 --- a/service-worker/tsconfig.json +++ b/service-worker/tsconfig.json @@ -1,5 +1,6 @@ { - "extends": "../tsconfig.json", + "extends": "../.nuxt/tsconfig.app.json", + "noEmit": true, "compilerOptions": { "lib": ["ESNext", "WebWorker", "DOM.Iterable"], "types": ["vite/client"] diff --git a/service-worker/tsconfig.tsbuildinfo b/service-worker/tsconfig.tsbuildinfo new file mode 100644 index 00000000..89b26dfb --- /dev/null +++ b/service-worker/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"root":["./elk-sw.ts","./notification.ts","./share-target.ts","./types.ts","./web-push-notifications.ts"],"version":"5.9.2"} \ No newline at end of file diff --git a/service-worker/web-push-notifications.ts b/service-worker/web-push-notifications.ts index 5bc7b2c7..9c004877 100644 --- a/service-worker/web-push-notifications.ts +++ b/service-worker/web-push-notifications.ts @@ -1,6 +1,6 @@ /// /// -import type { PushPayload } from '~~/service-worker/types' +import type { PushPayload } from './types' import { ELK_PAGE_LIFECYCLE_FROZEN } from '../app/constants' import { closeDatabaseConnections, diff --git a/shared/types/index.ts b/shared/types/index.ts index 4faa023f..0cca0843 100644 --- a/shared/types/index.ts +++ b/shared/types/index.ts @@ -1,5 +1,5 @@ -import type { RouteLocationRaw } from '#vue-router' import type { mastodon } from 'masto' +import type { RouteLocationRaw } from 'vue-router' import type { MarkNonNullable, Mutable } from './utils' export interface AppInfo { @@ -43,8 +43,6 @@ export interface GroupedLikeNotifications { export type NotificationSlot = GroupedNotifications | GroupedLikeNotifications | mastodon.v1.Notification -export type TranslateFn = ReturnType['t'] - export interface DraftItem { editingStatus?: mastodon.v1.Status initialText?: string diff --git a/tsconfig.json b/tsconfig.json index 4b34df15..eedd0afb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,20 @@ { - "extends": "./.nuxt/tsconfig.json" + "references": [ + { + "path": "./.nuxt/tsconfig.app.json" + }, + { + "path": "./.nuxt/tsconfig.server.json" + }, + { + "path": "./.nuxt/tsconfig.shared.json" + }, + { + "path": "./.nuxt/tsconfig.node.json" + }, + { + "path": "./service-worker/tsconfig.json" + } + ], + "files": [] }