From 0b68dea7d3ece27cab4d2280955ab65a81c7aa63 Mon Sep 17 00:00:00 2001 From: Alexandr SaVBaD Waltz Date: Wed, 4 Jun 2025 20:32:34 +0300 Subject: [PATCH] Extra: restore to Vue --- storefront/astro.config.mjs | 50 ----------------------- storefront/eslint.config.mjs | 16 -------- storefront/index.html | 13 ++++++ storefront/jsconfig.json | 10 ++--- storefront/public/favicon.svg | 9 ---- storefront/src/helpers/i18n-utils.js | 15 ------- storefront/src/pages/[locale]/index.astro | 8 ---- storefront/src/pages/[locale]/some.astro | 7 ---- storefront/src/pages/index.astro | 12 ------ storefront/src/plugins/i18n.js | 41 ------------------- storefront/src/plugins/index.js | 11 ----- storefront/vite.config.js | 37 +++++++++++++++++ 12 files changed, 53 insertions(+), 176 deletions(-) delete mode 100644 storefront/astro.config.mjs create mode 100644 storefront/index.html delete mode 100644 storefront/public/favicon.svg delete mode 100644 storefront/src/helpers/i18n-utils.js delete mode 100644 storefront/src/pages/[locale]/index.astro delete mode 100644 storefront/src/pages/[locale]/some.astro delete mode 100644 storefront/src/pages/index.astro delete mode 100644 storefront/src/plugins/i18n.js delete mode 100644 storefront/src/plugins/index.js create mode 100644 storefront/vite.config.js diff --git a/storefront/astro.config.mjs b/storefront/astro.config.mjs deleted file mode 100644 index 2083b781..00000000 --- a/storefront/astro.config.mjs +++ /dev/null @@ -1,50 +0,0 @@ -import { defineConfig } from 'astro/config'; -import node from '@astrojs/node'; -import vue from '@astrojs/vue'; -import {fileURLToPath, URL} from "node:url"; -import {DEFAULT_LOCALE, SUPPORTED_LOCALES} from "/src/config/index.js"; - -// https://astro.build/config -export default defineConfig({ - integrations: [ - vue({ - appEntrypoint: '/src/plugins/index.js', - devtools: { launchEditor: "webstorm" } - }), - ], - i18n: { - defaultLocale: DEFAULT_LOCALE, - locales: SUPPORTED_LOCALES.map(locale => locale.code), - routing: { - prefixDefaultLocale: true - } - }, - output: 'server', - adapter: node({ - mode: 'standalone' - }), - vite: { - // envDir: './', - envPrefix: 'EVIBES_', - resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - '@core': fileURLToPath(new URL('./src/core', import.meta.url)), - '@graphql': fileURLToPath(new URL('./src/graphql', import.meta.url)), - '@styles': fileURLToPath(new URL('./src/assets/styles', import.meta.url)), - '@icons': fileURLToPath(new URL('./src/assets/icons', import.meta.url)), - '@images': fileURLToPath(new URL('./src/assets/images', import.meta.url)), - } - }, - css: { - preprocessorOptions: { - scss: { - additionalData: ` - @use "@/assets/styles/global/variables.scss" as *; - @use "@/assets/styles/global/mixins.scss" as *; - ` - } - } - }, - } -}); \ No newline at end of file diff --git a/storefront/eslint.config.mjs b/storefront/eslint.config.mjs index 719b512d..142ee2c5 100644 --- a/storefront/eslint.config.mjs +++ b/storefront/eslint.config.mjs @@ -4,22 +4,6 @@ import vuePlugin from 'eslint-plugin-vue'; import vueParser from 'vue-eslint-parser'; export default [ - { - files: ['*.astro'], - languageOptions: { - parser: astroParser, - parserOptions: { - ecmaVersion: 2021, - sourceType: 'module', - }, - }, - plugins: { - astro: astroPlugin, - }, - extends: ['plugin:astro/recommended'], - rules: {}, - }, - { files: ['*.vue'], languageOptions: { diff --git a/storefront/index.html b/storefront/index.html new file mode 100644 index 00000000..8714c58b --- /dev/null +++ b/storefront/index.html @@ -0,0 +1,13 @@ + + + + + + + %EVIBES_PROJECT_NAME% + + +
+ + + \ No newline at end of file diff --git a/storefront/jsconfig.json b/storefront/jsconfig.json index 225527be..f2642f32 100644 --- a/storefront/jsconfig.json +++ b/storefront/jsconfig.json @@ -1,12 +1,8 @@ { "compilerOptions": { - "baseUrl": ".", "paths": { - "@/*": ["src/*"], - "@styles/*": ["src/assets/styles/*"], - "@icons/*": ["src/assets/icons/*"], - "@images/*": ["src/assets/images/*"] + "@/*": ["./src/*"] } }, - "include": ["src", "astro.config.mjs"] -} + "exclude": ["node_modules", "dist"] +} \ No newline at end of file diff --git a/storefront/public/favicon.svg b/storefront/public/favicon.svg deleted file mode 100644 index f157bd1c..00000000 --- a/storefront/public/favicon.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/storefront/src/helpers/i18n-utils.js b/storefront/src/helpers/i18n-utils.js deleted file mode 100644 index 0ef3ab43..00000000 --- a/storefront/src/helpers/i18n-utils.js +++ /dev/null @@ -1,15 +0,0 @@ -export async function loadAllLocaleMessages(supportedLocales) { - const messages = {} - - for (const locale of supportedLocales) { - try { - const localeMessages = await import(`@/locales/${locale.code}.json`) - messages[locale.code] = localeMessages.default || localeMessages - } catch (error) { - console.error(`Fetch locale error: ${locale.code}`, error) - messages[locale.code] = {} - } - } - - return messages -} \ No newline at end of file diff --git a/storefront/src/pages/[locale]/index.astro b/storefront/src/pages/[locale]/index.astro deleted file mode 100644 index ace62345..00000000 --- a/storefront/src/pages/[locale]/index.astro +++ /dev/null @@ -1,8 +0,0 @@ ---- -import DefaulLayout from '@/layouts/default-layout.astro'; -import HomeHero from '@/components/home/home-hero.vue'; ---- - - - - diff --git a/storefront/src/pages/[locale]/some.astro b/storefront/src/pages/[locale]/some.astro deleted file mode 100644 index e9f95d7c..00000000 --- a/storefront/src/pages/[locale]/some.astro +++ /dev/null @@ -1,7 +0,0 @@ ---- -import DefaulLayout from '@/layouts/default-layout.astro'; ---- - - - - diff --git a/storefront/src/pages/index.astro b/storefront/src/pages/index.astro deleted file mode 100644 index 6dcf9b22..00000000 --- a/storefront/src/pages/index.astro +++ /dev/null @@ -1,12 +0,0 @@ ---- -import { DEFAULT_LOCALE, COOKIES_LOCALE_KEY, SUPPORTED_LOCALES } from '@/config/index.js'; - -const savedLocale = Astro.cookies.get(COOKIES_LOCALE_KEY)?.value; -let redirectLocale = DEFAULT_LOCALE; - -if (savedLocale && SUPPORTED_LOCALES.some(locale => locale.code === savedLocale)) { - redirectLocale = savedLocale; -} - -return Astro.redirect(`/${redirectLocale}`); ---- \ No newline at end of file diff --git a/storefront/src/plugins/i18n.js b/storefront/src/plugins/i18n.js deleted file mode 100644 index c10ff967..00000000 --- a/storefront/src/plugins/i18n.js +++ /dev/null @@ -1,41 +0,0 @@ -import { createI18n } from 'vue-i18n' -import {DEFAULT_LOCALE, COOKIES_LOCALE_KEY, SUPPORTED_LOCALES} from "@/config/index.js"; -import { useCookies } from '@vueuse/integrations/useCookies' -import {loadAllLocaleMessages} from "@/helpers/i18n-utils.js"; - -const cookie = useCookies(['/', null, null]) - -const savedLocale = cookie.get(COOKIES_LOCALE_KEY) -const currentLocale = savedLocale && SUPPORTED_LOCALES.some(locale => locale.code === savedLocale) - ? savedLocale - : DEFAULT_LOCALE - -if (!savedLocale) { - cookie.set(COOKIES_LOCALE_KEY, DEFAULT_LOCALE) -} - -const i18n = createI18n({ - locale: currentLocale, - fallbackLocale: DEFAULT_LOCALE, - allowComposition: true, - legacy: false, - globalInjection: true, - messages: {} -}) - -export async function setupI18n() { - const messages = await loadAllLocaleMessages(SUPPORTED_LOCALES) - - Object.keys(messages).forEach(locale => { - i18n.global.setLocaleMessage(locale, messages[locale]) - }) - - const currentSavedLocale = cookie.get(COOKIES_LOCALE_KEY) - if (currentSavedLocale && SUPPORTED_LOCALES.some(locale => locale.code === currentSavedLocale)) { - i18n.global.locale.value = currentSavedLocale - } - - return i18n -} - -export default i18n diff --git a/storefront/src/plugins/index.js b/storefront/src/plugins/index.js deleted file mode 100644 index cdff1378..00000000 --- a/storefront/src/plugins/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import ElementPlus from 'element-plus'; -import i18n, { setupI18n } from '@/plugins/i18n'; - -export default async function (app) { - app.use(ElementPlus); - - await setupI18n(); - app.use(i18n); - - return app; -} \ No newline at end of file diff --git a/storefront/vite.config.js b/storefront/vite.config.js new file mode 100644 index 00000000..469563a6 --- /dev/null +++ b/storefront/vite.config.js @@ -0,0 +1,37 @@ +import { fileURLToPath, URL } from 'node:url' +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import vueDevTools from 'vite-plugin-vue-devtools' + +export default defineConfig({ + plugins: [ + vue(), + vueDevTools(), + ], + envDir: '../', + envPrefix: 'EVIBES_', + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)), + '@core': fileURLToPath(new URL('./src/core', import.meta.url)), + '@graphql': fileURLToPath(new URL('./src/graphql', import.meta.url)), + '@styles': fileURLToPath(new URL('./src/assets/styles', import.meta.url)), + '@icons': fileURLToPath(new URL('./src/assets/icons', import.meta.url)), + '@images': fileURLToPath(new URL('./src/assets/images', import.meta.url)), + }, + }, + css: { + preprocessorOptions: { + scss: { + additionalData: ` + @use "@/assets/styles/global/variables.scss" as *; + @use "@/assets/styles/global/mixins.scss" as *; + ` + } + } + }, + build: { + sourcemap: true, + target: 'ES2022', + } +}) \ No newline at end of file