From b064ac7c7468a0da3f2ed03e8f271c7b79027107 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Tue, 14 Jul 2026 22:27:40 +0300 Subject: [PATCH] fix(app-shared): clear 6 type errors blocking docs typecheck Declare the previously-undeclared deps that `nuxt typecheck` surfaced when traversing apps/docs -> apps/shared, and fix two module-config typings: - add `git-url-parse`, `pkg-types`, `vue` to apps/shared deps (catalog:nuxt). git-url-parse@16 ships its own `lib/index.d.ts`, so no @types stub is needed (the @types/git-url-parse package is a deprecated no-op). - app/plugins/i18n.ts: type the public i18n runtime config so `defaultLocale` resolves off `{}`. - modules/config.ts: guard `nuxt.options.site` (`false | ModuleOptions`) before reading `.name`, and assert the defu result back to the site type. Stage 1 of SF-26. apps/docs untouched (Stage 2, Larousse). --- apps/shared/app/plugins/i18n.ts | 4 +++- apps/shared/modules/config.ts | 8 ++++++-- apps/shared/package.json | 3 +++ pnpm-lock.yaml | 9 +++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/shared/app/plugins/i18n.ts b/apps/shared/app/plugins/i18n.ts index 431a4926..9094982d 100644 --- a/apps/shared/app/plugins/i18n.ts +++ b/apps/shared/app/plugins/i18n.ts @@ -1,7 +1,9 @@ export default defineNuxtPlugin(() => { const nuxtApp = useNuxtApp(); - const i18nConfig = nuxtApp.$config.public.i18n; + const i18nConfig = nuxtApp.$config.public.i18n as + | { defaultLocale?: string } + | undefined; if (!i18nConfig) { return; } diff --git a/apps/shared/modules/config.ts b/apps/shared/modules/config.ts index 0f44cad3..a7f55afc 100644 --- a/apps/shared/modules/config.ts +++ b/apps/shared/modules/config.ts @@ -14,8 +14,12 @@ export default defineNuxtModule({ const url = inferSiteURL(); const meta = await getPackageJsonMetadata(dir); const gitInfo = (await getLocalGitInfo(dir)) || getGitEnv(); + const site = nuxt.options.site; const siteName = - nuxt.options?.site?.name || meta.name || gitInfo?.name || ""; + (typeof site === "object" ? site.name : undefined) || + meta.name || + gitInfo?.name || + ""; nuxt.options.llms = defu(nuxt.options.llms, { domain: url, @@ -31,7 +35,7 @@ export default defineNuxtModule({ url, name: siteName, debug: false, - }); + }) as typeof nuxt.options.site; nuxt.options.appConfig.header = defu(nuxt.options.appConfig.header, { title: siteName, diff --git a/apps/shared/package.json b/apps/shared/package.json index e9b3123d..02ab98d7 100644 --- a/apps/shared/package.json +++ b/apps/shared/package.json @@ -13,12 +13,15 @@ "@nuxtjs/i18n": "catalog:nuxt", "@nuxtjs/mdc": "catalog:nuxt", "@nuxtjs/robots": "catalog:nuxt", + "git-url-parse": "catalog:nuxt", "nuxt": "catalog:nuxt", "nuxt-llms": "catalog:nuxt", "nuxt-og-image": "catalog:nuxt", "defu": "catalog:", + "pkg-types": "catalog:nuxt", "posthog-js": "catalog:nuxt", "tailwindcss": "catalog:nuxt", + "vue": "catalog:nuxt", "zod": "catalog:" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 575aced9..d4402088 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -630,6 +630,9 @@ importers: defu: specifier: 'catalog:' version: 6.1.7 + git-url-parse: + specifier: catalog:nuxt + version: 16.1.0 nuxt: specifier: catalog:nuxt version: 4.4.8(@babel/plugin-syntax-jsx@7.27.1(@babel/core@7.29.0))(@babel/plugin-syntax-typescript@7.28.6(@babel/core@7.29.0))(@biomejs/biome@2.5.0)(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.6)(@types/node@24.10.4)(@vue/compiler-sfc@3.5.38)(better-sqlite3@12.10.1)(cac@6.7.14)(db0@0.3.4(better-sqlite3@12.10.1))(eslint@9.37.0(jiti@2.7.0))(ioredis@5.10.1)(lightningcss@1.32.0)(magicast@0.5.3)(optionator@0.9.4)(oxlint@1.69.0)(rolldown@1.1.1)(rollup-plugin-visualizer@7.0.1(rolldown@1.1.1)(rollup@4.62.0))(rollup@4.62.0)(terser@5.44.0)(tsx@4.22.4)(typescript@6.0.3)(vite@8.0.16(@types/node@24.10.4)(esbuild@0.28.0)(jiti@2.7.0)(terser@5.44.0)(tsx@4.22.4)(yaml@2.9.0))(vue-tsc@3.3.5(typescript@6.0.3))(yaml@2.9.0) @@ -639,12 +642,18 @@ importers: nuxt-og-image: specifier: catalog:nuxt version: 6.6.0(62e7d22600edcdd52d54fbb4abcf763e) + pkg-types: + specifier: catalog:nuxt + version: 2.3.1 posthog-js: specifier: catalog:nuxt version: 1.386.6 tailwindcss: specifier: catalog:nuxt version: 4.3.1 + vue: + specifier: catalog:nuxt + version: 3.5.38(typescript@6.0.3) zod: specifier: 'catalog:' version: 4.4.3