Skip to content

Commit

Permalink
chore(project): dynamic manifest.json
Browse files Browse the repository at this point in the history
Co-authored-by: Mike van Veenhuijzen <[email protected]>
  • Loading branch information
2 people authored and ChristiaanScheermeijer committed Jan 29, 2024
1 parent 06af46f commit 6a10ea5
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 24 deletions.
8 changes: 4 additions & 4 deletions platforms/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>JW OTT Webapp</title>
<title><% name %></title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="description" content="JW OTT Webapp is an open-source, dynamically generated video website." data-react-helmet="true" />
<meta name="description" content="<% description %>" data-react-helmet="true" />
<meta name="twitter:card" content="summary" data-react-helmet="true" />
<meta property="og:title" content="JW OTT Webapp" data-react-helmet="true" >
<meta property="og:description" content="JW OTT Webapp is an open-source, dynamically generated video website." data-react-helmet="true">
<meta property="og:title" content="<% name %>" data-react-helmet="true" >
<meta property="og:description" content="<% description %>" data-react-helmet="true">
<meta property="og:image" content="/images/icons/app-icon.png" data-react-helmet="true">

<link rel="icon" href="/images/icons/favicon.ico" type="image/x-icon" sizes="any">
Expand Down
3 changes: 2 additions & 1 deletion platforms/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
},
"optionalDependencies": {
"gh-pages": "^3.2.3",
"lighthouse": "^9.6.7"
"lighthouse": "^9.6.7",
"sharp": "^0.33.2"
}
}
Binary file not shown.
18 changes: 0 additions & 18 deletions platforms/web/public/manifest.json

This file was deleted.

6 changes: 6 additions & 0 deletions platforms/web/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ interface Window {
interface HTMLDivElement {
inert: boolean;
}

type OTTConfig = {
name: string;
shortname: string;
description: string;
};
35 changes: 34 additions & 1 deletion platforms/web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export default ({ mode, command }: ConfigEnv): UserConfigExport => {

const localFile = initSettings(mode);

const app: OTTConfig = {
name: process.env.APP_NAME || 'JW OTT Webapp',
shortname: process.env.APP_SHORT_NAME || 'JW OTT',
description: process.env.APP_DESCRIPTION || 'JW OTT Webapp is an open-source, dynamically generated video website.',
};

// Make sure to builds are always production type,
// otherwise modes other than 'production' get built in dev
if (command === 'build') {
Expand Down Expand Up @@ -93,11 +99,38 @@ export default ({ mode, command }: ConfigEnv): UserConfigExport => {
eslintPlugin({ emitError: mode === 'production' || mode === 'demo' || mode === 'preview' }), // Move linting to pre-build to match dashboard
StylelintPlugin(),
svgr(),
VitePWA(),
VitePWA({
manifestFilename: 'manifest.json',
manifest: {
name: app.name,
description: app.description,
short_name: app.shortname,
display: 'standalone',
start_url: '/',
theme_color: '#DD0000',
orientation: 'any',
background_color: '#000',
related_applications: [],
prefer_related_applications: false,
icons: [
{
src: 'images/icons/pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'images/icons/pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
},
}),
createHtmlPlugin({
minify: true,
inject: {
tags: getGoogleScripts(),
data: app,
},
}),
viteStaticCopy({
Expand Down

0 comments on commit 6a10ea5

Please sign in to comment.