From 49ed645aecbec9b324c2631a9e8acd5f4621f3d3 Mon Sep 17 00:00:00 2001 From: Xibman Date: Sat, 4 Jan 2025 12:27:07 +0100 Subject: [PATCH 1/4] docs(opting nuxt 4): apply new directory structure --- docs/{ => app}/app.config.ts | 0 docs/{ => app}/app.vue | 0 docs/{ => app}/components/OgImage/OgImageDocs.vue | 0 docs/{ => app}/components/TheFooter.vue | 0 docs/{ => app}/components/TheHeader.vue | 0 docs/{ => app}/error.vue | 0 docs/{ => app}/layouts/docs.vue | 0 docs/{ => app}/pages/[...slug].vue | 0 docs/{ => app}/pages/index.vue | 0 docs/{ => app}/pages/playground.vue | 0 docs/nuxt.config.ts | 4 ++++ 11 files changed, 4 insertions(+) rename docs/{ => app}/app.config.ts (100%) rename docs/{ => app}/app.vue (100%) rename docs/{ => app}/components/OgImage/OgImageDocs.vue (100%) rename docs/{ => app}/components/TheFooter.vue (100%) rename docs/{ => app}/components/TheHeader.vue (100%) rename docs/{ => app}/error.vue (100%) rename docs/{ => app}/layouts/docs.vue (100%) rename docs/{ => app}/pages/[...slug].vue (100%) rename docs/{ => app}/pages/index.vue (100%) rename docs/{ => app}/pages/playground.vue (100%) diff --git a/docs/app.config.ts b/docs/app/app.config.ts similarity index 100% rename from docs/app.config.ts rename to docs/app/app.config.ts diff --git a/docs/app.vue b/docs/app/app.vue similarity index 100% rename from docs/app.vue rename to docs/app/app.vue diff --git a/docs/components/OgImage/OgImageDocs.vue b/docs/app/components/OgImage/OgImageDocs.vue similarity index 100% rename from docs/components/OgImage/OgImageDocs.vue rename to docs/app/components/OgImage/OgImageDocs.vue diff --git a/docs/components/TheFooter.vue b/docs/app/components/TheFooter.vue similarity index 100% rename from docs/components/TheFooter.vue rename to docs/app/components/TheFooter.vue diff --git a/docs/components/TheHeader.vue b/docs/app/components/TheHeader.vue similarity index 100% rename from docs/components/TheHeader.vue rename to docs/app/components/TheHeader.vue diff --git a/docs/error.vue b/docs/app/error.vue similarity index 100% rename from docs/error.vue rename to docs/app/error.vue diff --git a/docs/layouts/docs.vue b/docs/app/layouts/docs.vue similarity index 100% rename from docs/layouts/docs.vue rename to docs/app/layouts/docs.vue diff --git a/docs/pages/[...slug].vue b/docs/app/pages/[...slug].vue similarity index 100% rename from docs/pages/[...slug].vue rename to docs/app/pages/[...slug].vue diff --git a/docs/pages/index.vue b/docs/app/pages/index.vue similarity index 100% rename from docs/pages/index.vue rename to docs/app/pages/index.vue diff --git a/docs/pages/playground.vue b/docs/app/pages/playground.vue similarity index 100% rename from docs/pages/playground.vue rename to docs/app/pages/playground.vue diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts index 7a9d706..91bd2f0 100644 --- a/docs/nuxt.config.ts +++ b/docs/nuxt.config.ts @@ -15,6 +15,10 @@ export default defineNuxtConfig({ routeRules: { '/api/search.json': { prerender: true }, }, + future: { + compatibilityVersion: 4, + typescriptBundlerResolution: true, + }, compatibilityDate: '2024-12-24', typescript: { strict: false }, hooks: { From bdb564fee5f1e4a82e2c3fc4c42624baa7d8ccd7 Mon Sep 17 00:00:00 2001 From: Xibman Date: Sat, 4 Jan 2025 12:29:36 +0100 Subject: [PATCH 2/4] refactor(playground): opting Nuxt 4 apply new Directory Structure --- playground/{ => app}/app.vue | 0 playground/{ => app}/components/VLocalSwitcher.vue | 0 playground/{ => app}/components/VNavigation.vue | 0 playground/{ => app}/pages/complex.vue | 0 playground/{ => app}/pages/index.vue | 0 playground/{ => app}/pages/overload.vue | 0 playground/{ => app}/schema/index.ts | 0 playground/{ => app}/schema/login.schema.ts | 0 playground/{ => app}/schema/user.schema.ts | 0 playground/{ => app}/schema/website.schema.ts | 0 playground/nuxt.config.ts | 6 +++++- 11 files changed, 5 insertions(+), 1 deletion(-) rename playground/{ => app}/app.vue (100%) rename playground/{ => app}/components/VLocalSwitcher.vue (100%) rename playground/{ => app}/components/VNavigation.vue (100%) rename playground/{ => app}/pages/complex.vue (100%) rename playground/{ => app}/pages/index.vue (100%) rename playground/{ => app}/pages/overload.vue (100%) rename playground/{ => app}/schema/index.ts (100%) rename playground/{ => app}/schema/login.schema.ts (100%) rename playground/{ => app}/schema/user.schema.ts (100%) rename playground/{ => app}/schema/website.schema.ts (100%) diff --git a/playground/app.vue b/playground/app/app.vue similarity index 100% rename from playground/app.vue rename to playground/app/app.vue diff --git a/playground/components/VLocalSwitcher.vue b/playground/app/components/VLocalSwitcher.vue similarity index 100% rename from playground/components/VLocalSwitcher.vue rename to playground/app/components/VLocalSwitcher.vue diff --git a/playground/components/VNavigation.vue b/playground/app/components/VNavigation.vue similarity index 100% rename from playground/components/VNavigation.vue rename to playground/app/components/VNavigation.vue diff --git a/playground/pages/complex.vue b/playground/app/pages/complex.vue similarity index 100% rename from playground/pages/complex.vue rename to playground/app/pages/complex.vue diff --git a/playground/pages/index.vue b/playground/app/pages/index.vue similarity index 100% rename from playground/pages/index.vue rename to playground/app/pages/index.vue diff --git a/playground/pages/overload.vue b/playground/app/pages/overload.vue similarity index 100% rename from playground/pages/overload.vue rename to playground/app/pages/overload.vue diff --git a/playground/schema/index.ts b/playground/app/schema/index.ts similarity index 100% rename from playground/schema/index.ts rename to playground/app/schema/index.ts diff --git a/playground/schema/login.schema.ts b/playground/app/schema/login.schema.ts similarity index 100% rename from playground/schema/login.schema.ts rename to playground/app/schema/login.schema.ts diff --git a/playground/schema/user.schema.ts b/playground/app/schema/user.schema.ts similarity index 100% rename from playground/schema/user.schema.ts rename to playground/app/schema/user.schema.ts diff --git a/playground/schema/website.schema.ts b/playground/app/schema/website.schema.ts similarity index 100% rename from playground/schema/website.schema.ts rename to playground/app/schema/website.schema.ts diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index 7df9b1d..b31ad1e 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -1,12 +1,16 @@ export default defineNuxtConfig({ modules: ['../src/module', '@nuxtjs/i18n', '@nuxt/ui'], devtools: { enabled: true }, + future: { + compatibilityVersion: 4, + typescriptBundlerResolution: true, + }, compatibilityDate: '2024-12-24', i18n: { defaultDirection: 'ltr', defaultLocale: 'en-GB', - langDir: './locales', + langDir: 'locales', lazy: true, locales: [ { From 8396dabec47f2857068370636c8dd546aa22e282 Mon Sep 17 00:00:00 2001 From: Xibman Date: Sat, 4 Jan 2025 12:43:10 +0100 Subject: [PATCH 3/4] refactor(eslint): update directory to target app folder for linting --- eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 4aa0447..6d8d76c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -12,7 +12,7 @@ export default createConfigForNuxt({ typescript: true, }, dirs: { - src: ['./playground', './docs'], + src: ['./playground/app', './docs/app'], }, }).append([ ...eslintPluginJsonc.configs['flat/recommended-with-jsonc'], From 712823475fb3b9fd190e40d5d2037c5963ef582a Mon Sep 17 00:00:00 2001 From: Xibman Date: Sat, 4 Jan 2025 12:53:08 +0100 Subject: [PATCH 4/4] refactor(module): apply New Directory Structure places locales files into i18n folder --- src/module.ts | 4 ++-- src/runtime/{ => i18n}/locales/cs-CZ.json | 0 src/runtime/{ => i18n}/locales/de-DE.json | 0 src/runtime/{ => i18n}/locales/en-GB.json | 0 src/runtime/{ => i18n}/locales/es-ES.json | 0 src/runtime/{ => i18n}/locales/fa-IR.json | 0 src/runtime/{ => i18n}/locales/fr-FR.json | 0 src/runtime/{ => i18n}/locales/hu-HU.json | 0 src/runtime/{ => i18n}/locales/id-ID.json | 0 src/runtime/{ => i18n}/locales/it-IT.json | 0 src/runtime/{ => i18n}/locales/pt-PT.json | 0 src/runtime/{ => i18n}/locales/ru-RU.json | 0 src/runtime/{ => i18n}/locales/sk-SK.json | 0 src/runtime/{ => i18n}/locales/tr-TR.json | 0 src/runtime/{ => i18n}/locales/uk-UA.json | 0 src/runtime/{ => i18n}/locales/zh-CN.json | 0 src/runtime/{ => i18n}/locales/zh-TW.json | 0 17 files changed, 2 insertions(+), 2 deletions(-) rename src/runtime/{ => i18n}/locales/cs-CZ.json (100%) rename src/runtime/{ => i18n}/locales/de-DE.json (100%) rename src/runtime/{ => i18n}/locales/en-GB.json (100%) rename src/runtime/{ => i18n}/locales/es-ES.json (100%) rename src/runtime/{ => i18n}/locales/fa-IR.json (100%) rename src/runtime/{ => i18n}/locales/fr-FR.json (100%) rename src/runtime/{ => i18n}/locales/hu-HU.json (100%) rename src/runtime/{ => i18n}/locales/id-ID.json (100%) rename src/runtime/{ => i18n}/locales/it-IT.json (100%) rename src/runtime/{ => i18n}/locales/pt-PT.json (100%) rename src/runtime/{ => i18n}/locales/ru-RU.json (100%) rename src/runtime/{ => i18n}/locales/sk-SK.json (100%) rename src/runtime/{ => i18n}/locales/tr-TR.json (100%) rename src/runtime/{ => i18n}/locales/uk-UA.json (100%) rename src/runtime/{ => i18n}/locales/zh-CN.json (100%) rename src/runtime/{ => i18n}/locales/zh-TW.json (100%) diff --git a/src/module.ts b/src/module.ts index be0e693..2db5e5c 100644 --- a/src/module.ts +++ b/src/module.ts @@ -87,7 +87,7 @@ export default defineNuxtModule().with({ : [], ).map(({ code }) => code) - const languageFiles = await readdir(resolve('./runtime/locales')) + const languageFiles = await readdir(resolve('./runtime/i18n/locales')) const locales = languageFiles.reduce((acc, file) => { const code @@ -102,7 +102,7 @@ export default defineNuxtModule().with({ nuxt.hook('i18n:registerModule', (register) => { register({ - langDir: resolve('./runtime/locales'), + langDir: resolve('./runtime/i18n/locales'), locales, }) }) diff --git a/src/runtime/locales/cs-CZ.json b/src/runtime/i18n/locales/cs-CZ.json similarity index 100% rename from src/runtime/locales/cs-CZ.json rename to src/runtime/i18n/locales/cs-CZ.json diff --git a/src/runtime/locales/de-DE.json b/src/runtime/i18n/locales/de-DE.json similarity index 100% rename from src/runtime/locales/de-DE.json rename to src/runtime/i18n/locales/de-DE.json diff --git a/src/runtime/locales/en-GB.json b/src/runtime/i18n/locales/en-GB.json similarity index 100% rename from src/runtime/locales/en-GB.json rename to src/runtime/i18n/locales/en-GB.json diff --git a/src/runtime/locales/es-ES.json b/src/runtime/i18n/locales/es-ES.json similarity index 100% rename from src/runtime/locales/es-ES.json rename to src/runtime/i18n/locales/es-ES.json diff --git a/src/runtime/locales/fa-IR.json b/src/runtime/i18n/locales/fa-IR.json similarity index 100% rename from src/runtime/locales/fa-IR.json rename to src/runtime/i18n/locales/fa-IR.json diff --git a/src/runtime/locales/fr-FR.json b/src/runtime/i18n/locales/fr-FR.json similarity index 100% rename from src/runtime/locales/fr-FR.json rename to src/runtime/i18n/locales/fr-FR.json diff --git a/src/runtime/locales/hu-HU.json b/src/runtime/i18n/locales/hu-HU.json similarity index 100% rename from src/runtime/locales/hu-HU.json rename to src/runtime/i18n/locales/hu-HU.json diff --git a/src/runtime/locales/id-ID.json b/src/runtime/i18n/locales/id-ID.json similarity index 100% rename from src/runtime/locales/id-ID.json rename to src/runtime/i18n/locales/id-ID.json diff --git a/src/runtime/locales/it-IT.json b/src/runtime/i18n/locales/it-IT.json similarity index 100% rename from src/runtime/locales/it-IT.json rename to src/runtime/i18n/locales/it-IT.json diff --git a/src/runtime/locales/pt-PT.json b/src/runtime/i18n/locales/pt-PT.json similarity index 100% rename from src/runtime/locales/pt-PT.json rename to src/runtime/i18n/locales/pt-PT.json diff --git a/src/runtime/locales/ru-RU.json b/src/runtime/i18n/locales/ru-RU.json similarity index 100% rename from src/runtime/locales/ru-RU.json rename to src/runtime/i18n/locales/ru-RU.json diff --git a/src/runtime/locales/sk-SK.json b/src/runtime/i18n/locales/sk-SK.json similarity index 100% rename from src/runtime/locales/sk-SK.json rename to src/runtime/i18n/locales/sk-SK.json diff --git a/src/runtime/locales/tr-TR.json b/src/runtime/i18n/locales/tr-TR.json similarity index 100% rename from src/runtime/locales/tr-TR.json rename to src/runtime/i18n/locales/tr-TR.json diff --git a/src/runtime/locales/uk-UA.json b/src/runtime/i18n/locales/uk-UA.json similarity index 100% rename from src/runtime/locales/uk-UA.json rename to src/runtime/i18n/locales/uk-UA.json diff --git a/src/runtime/locales/zh-CN.json b/src/runtime/i18n/locales/zh-CN.json similarity index 100% rename from src/runtime/locales/zh-CN.json rename to src/runtime/i18n/locales/zh-CN.json diff --git a/src/runtime/locales/zh-TW.json b/src/runtime/i18n/locales/zh-TW.json similarity index 100% rename from src/runtime/locales/zh-TW.json rename to src/runtime/i18n/locales/zh-TW.json