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=
VITE_ENVIRONMENT=development
VITE_WEB_URL=http://localhost:5173
VITE_SENTRY_DSN=
VITE_GTM_ID=
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" />
<link rel="icon" href="/icons/icon.ico" />
<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" />
<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="Share your tune and logs" />
<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:image" content="https://hypertuner.cloud/img/screen2.png">
<meta property="og:url" content="https://hypertuner.cloud">
<meta name="description" content="<%- metaDescription %>">
<title><%- metaTitle %></title>
<meta property="og:title" content="<%- metaTitle %>">
<meta property="og:site_name" content="<%- metaTitle %>">
<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="description" content="HyperTuner - Share your tunes and logs" />
<title>HyperTuner Cloud</title>
<meta name="twitter:image:alt" content="<%- metaTitle %>">
<meta name="theme-color" content="<%- metaThemeColor %>">
</head>
<body style="background-color: #191C1E">
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!-- 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",
"prettier": "^2.7.1",
"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 {
overflow: hidden;
background-color: @main-dark;
}
html, body {

View File

@ -1,40 +1,108 @@
import { defineConfig } from 'vite';
import {
defineConfig,
loadEnv,
} from 'vite';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import { createHtmlPlugin } from 'vite-plugin-html';
import { VitePWA } from 'vite-plugin-pwa';
// https://vitejs.dev/config/
export default defineConfig({
build: {
outDir: 'build',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
react: ['react', 'react-dom'],
antdResult: ['antd/es/result'],
antdTable: ['antd/es/table'],
antdIcons: ['@ant-design/icons'],
uplot: ['uplot'],
sentry: ['@sentry/react', '@sentry/browser', '@sentry/tracing'],
kbar: ['kbar'],
perfectScrollbar: ['perfect-scrollbar'],
pako: ['pako'],
mlgConverter: ['mlg-converter'],
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd());
return defineConfig({
build: {
outDir: 'build',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
react: ['react', 'react-dom'],
antdResult: ['antd/es/result'],
antdTable: ['antd/es/table'],
antdIcons: ['@ant-design/icons'],
uplot: ['uplot'],
sentry: ['@sentry/react', '@sentry/browser', '@sentry/tracing'],
kbar: ['kbar'],
perfectScrollbar: ['perfect-scrollbar'],
pako: ['pako'],
mlgConverter: ['mlg-converter'],
},
},
},
},
},
server: {
open: true,
host: '0.0.0.0',
},
css: {
preprocessorOptions: {
less: { javascriptEnabled: true },
server: {
open: true,
host: '0.0.0.0',
},
},
plugins: [
react(),
visualizer(),
],
});
css: {
preprocessorOptions: {
less: { javascriptEnabled: true },
},
},
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',
},
],
},
}),
],
});
};