Extra: restore to Vue
This commit is contained in:
parent
11d6534a40
commit
0b68dea7d3
12 changed files with 53 additions and 176 deletions
|
|
@ -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 *;
|
||||
`
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
@ -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: {
|
||||
|
|
|
|||
13
storefront/index.html
Normal file
13
storefront/index.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>%EVIBES_PROJECT_NAME%</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -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"]
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
|
||||
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
|
||||
<style>
|
||||
path { fill: #000; }
|
||||
@media (prefers-color-scheme: dark) {
|
||||
path { fill: #FFF; }
|
||||
}
|
||||
</style>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 749 B |
|
|
@ -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
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
import DefaulLayout from '@/layouts/default-layout.astro';
|
||||
import HomeHero from '@/components/home/home-hero.vue';
|
||||
---
|
||||
|
||||
<DefaulLayout>
|
||||
<HomeHero />
|
||||
</DefaulLayout>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
import DefaulLayout from '@/layouts/default-layout.astro';
|
||||
---
|
||||
|
||||
<DefaulLayout>
|
||||
|
||||
</DefaulLayout>
|
||||
|
|
@ -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}`);
|
||||
---
|
||||
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
}
|
||||
37
storefront/vite.config.js
Normal file
37
storefront/vite.config.js
Normal file
|
|
@ -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',
|
||||
}
|
||||
})
|
||||
Loading…
Reference in a new issue