Move metadata to envs, enable PWA (#860)

This commit is contained in:
Piotr Rogowski 2022-10-29 23:55:45 +02:00 committed by GitHub
parent e6e9ef2b1c
commit 56f9699fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 5067 additions and 132 deletions

6
.env
View File

@ -1,6 +1,12 @@
NPM_GITHUB_TOKEN= NPM_GITHUB_TOKEN=
VITE_ENVIRONMENT=development VITE_ENVIRONMENT=development
VITE_WEB_URL=http://localhost:5173 VITE_WEB_URL=http://localhost:5173
VITE_SENTRY_DSN= VITE_SENTRY_DSN=
VITE_GTM_ID= VITE_GTM_ID=
VITE_POCKETBASE_API_URL="https://api.hypertuner.cloud" VITE_POCKETBASE_API_URL="https://api.hypertuner.cloud"
VITE_META_TITLE="HyperTuner Cloud"
VITE_META_DESCRIPTION="The best way to share your Speeduino and rusEFI tunes and logs"
VITE_META_IMAGE="The best way to share your Speeduino and rusEFI tunes and logs"
VITE_META_THEME_COLOR="#191C1E"

View File

@ -4,21 +4,24 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="/icons/icon.ico" /> <link rel="icon" href="/icons/icon.ico" />
<link rel="apple-touch-icon" href="/icons/icon.png" /> <link rel="apple-touch-icon" href="/icons/icon.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://apis.google.com" crossorigin> <link rel="preconnect" href="https://apis.google.com" crossorigin>
<meta property="og:title" content="HyperTuner Cloud">
<meta name="twitter:image:alt" content="HyperTuner Cloud"> <meta name="description" content="<%- metaDescription %>">
<meta name="description" content="Share your tune and logs" /> <title><%- metaTitle %></title>
<meta property="og:description" content="The best way to share your Speeduino and rusEFI tunes and logs">
<meta property="og:site_name" content="The best way to share your Speeduino and rusEFI tunes and logs"> <meta property="og:title" content="<%- metaTitle %>">
<meta property="og:image" content="https://hypertuner.cloud/img/screen2.png"> <meta property="og:site_name" content="<%- metaTitle %>">
<meta property="og:url" content="https://hypertuner.cloud"> <meta property="og:description" content="<%- metaDescription %>">
<meta property="og:image" content="<%- metaImage %>">
<meta property="og:url" content="<%- metaUrl %>">
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">
<meta name="description" content="HyperTuner - Share your tunes and logs" /> <meta name="twitter:image:alt" content="<%- metaTitle %>">
<title>HyperTuner Cloud</title>
<meta name="theme-color" content="<%- metaThemeColor %>">
</head> </head>
<body style="background-color: #191C1E"> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<!-- Vite entrypoint --> <!-- Vite entrypoint -->

4985
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,8 @@
"pocketbase-typegen": "^1.0.11", "pocketbase-typegen": "^1.0.11",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"rollup-plugin-visualizer": "^5.8.3", "rollup-plugin-visualizer": "^5.8.3",
"typescript": "^4.8.4" "typescript": "^4.8.4",
"vite-plugin-html": "^3.2.0",
"vite-plugin-pwa": "^0.13.1"
} }
} }

View File

@ -1,44 +0,0 @@
{
"short_name": "HyperTuner Cloud",
"name": "HyperTuner Cloud",
"description": "The best way to share your Speeduino and rusEFI tunes and logs",
"icons": [
{
"src": "/icons/icon.ico",
"type": "image/x-icon",
"sizes": "256x256"
},
{
"src": "/icons/icon.png",
"type": "image/png",
"sizes": "512x512"
}
],
"screenshots" : [
{
"src": "/img/screen1.png",
"sizes": "3008x2050",
"type": "image/png",
"platform": "wide",
"label": "Tune view"
},
{
"src": "/img/screen2.png",
"sizes": "3008x2050",
"type": "image/png",
"platform": "wide",
"label": "Log viewer"
},
{
"src": "/img/screen3.png",
"sizes": "3008x2050",
"type": "image/png",
"platform": "wide",
"label": "Tooth log viewer"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#191C1E",
"background_color": "#191C1E"
}

View File

@ -8,6 +8,7 @@
body { body {
overflow: hidden; overflow: hidden;
background-color: @main-dark;
} }
html, body { html, body {

View File

@ -1,40 +1,108 @@
import { defineConfig } from 'vite'; import {
defineConfig,
loadEnv,
} from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer'; import { visualizer } from 'rollup-plugin-visualizer';
import { createHtmlPlugin } from 'vite-plugin-html';
import { VitePWA } from 'vite-plugin-pwa';
// https://vitejs.dev/config/ export default ({ mode }) => {
export default defineConfig({ const env = loadEnv(mode, process.cwd());
build: {
outDir: 'build', return defineConfig({
sourcemap: true, build: {
rollupOptions: { outDir: 'build',
output: { sourcemap: true,
manualChunks: { rollupOptions: {
react: ['react', 'react-dom'], output: {
antdResult: ['antd/es/result'], manualChunks: {
antdTable: ['antd/es/table'], react: ['react', 'react-dom'],
antdIcons: ['@ant-design/icons'], antdResult: ['antd/es/result'],
uplot: ['uplot'], antdTable: ['antd/es/table'],
sentry: ['@sentry/react', '@sentry/browser', '@sentry/tracing'], antdIcons: ['@ant-design/icons'],
kbar: ['kbar'], uplot: ['uplot'],
perfectScrollbar: ['perfect-scrollbar'], sentry: ['@sentry/react', '@sentry/browser', '@sentry/tracing'],
pako: ['pako'], kbar: ['kbar'],
mlgConverter: ['mlg-converter'], perfectScrollbar: ['perfect-scrollbar'],
pako: ['pako'],
mlgConverter: ['mlg-converter'],
},
}, },
}, },
}, },
}, server: {
server: { open: true,
open: true, host: '0.0.0.0',
host: '0.0.0.0',
},
css: {
preprocessorOptions: {
less: { javascriptEnabled: true },
}, },
}, css: {
plugins: [ preprocessorOptions: {
react(), less: { javascriptEnabled: true },
visualizer(), },
], },
}); plugins: [
react(),
visualizer(),
createHtmlPlugin({
template: '/index.html',
inject: {
data: {
metaTitle: env.VITE_META_TITLE,
metaDescription: env.VITE_META_DESCRIPTION,
metaImage: `${env.VITE_WEB_URL}/img/screen2.png`,
metaUrl: env.VITE_WEB_URL,
metaThemeColor: env.VITE_META_THEME_COLOR,
},
},
}),
VitePWA({
registerType: null,
devOptions: { enabled: true },
manifest: {
name: env.VITE_META_TITLE,
short_name: env.VITE_META_TITLE,
description: env.VITE_META_DESCRIPTION,
start_url: '.',
display: 'standalone',
theme_color: env.VITE_META_THEME_COLOR,
background_color: env.VITE_META_THEME_COLOR,
icons: [
{
src: '/icons/icon.ico',
type: 'image/x-icon',
sizes: '256x256',
},
{
src: '/icons/icon.png',
type: 'image/png',
sizes: '512x512',
},
],
screenshots: [
{
src: '/img/screen1.png',
sizes: '3008x2050',
type: 'image/png',
platform: 'wide',
label: 'Tune view',
},
{
src: '/img/screen2.png',
sizes: '3008x2050',
type: 'image/png',
platform: 'wide',
label: 'Log viewer',
},
{
src: '/img/screen3.png',
sizes: '3008x2050',
type: 'image/png',
platform: 'wide',
label: 'Tooth log viewer',
},
],
},
}),
],
});
};