Skip to content

Commit

Permalink
update: favion for PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilal Meddah committed Jan 8, 2024
1 parent ec8ece1 commit b896094
Show file tree
Hide file tree
Showing 5 changed files with 1,098 additions and 30 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<title>Nexus Fusion</title>
<!--app-head-->
</head>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"vite-compatible-readable-stream": "^3.6.1",
"vite-plugin-dynamic-base": "^1.0.0",
"vite-plugin-dynamic-import": "^1.5.0",
"vite-plugin-favicon2": "^1.1.5",
"vitest": "^1.1.1"
},
"prettier": {
Expand Down
1 change: 1 addition & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 22 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ import tsconfigPaths from 'vite-tsconfig-paths';
import commonjs from 'vite-plugin-commonjs';
import viteCompression from 'vite-plugin-compression';
import 'vite-compatible-readable-stream';
import { ViteFaviconsPlugin } from "vite-plugin-favicon2";

const versionRegex = /^v(\d+\.\d+\.\d+)/;
export default defineConfig(() => {
let commitHash = '', version = '';

if(process.env.VITEST !== 'true') {
if (process.env.VITEST !== 'true') {
try {
commitHash = execSync('git rev-parse HEAD').toString().trimEnd();
version = execSync('git describe --tags --always').toString().trimEnd();
} catch (error) {
console.log('⛔️ describe may not getting the latest tag')
}
}
const appVersion = version.match(versionRegex)?.[1] ?? '';

return ({
base: process.env.NODE_ENV === 'production' ? "/__BASE__/" : "/",
Expand All @@ -35,7 +37,24 @@ export default defineConfig(() => {
dynamicBase({
publicPath: 'window.__BASE__',
transformIndexHtml: true,
})
}),
ViteFaviconsPlugin({
inject: true,
logo: './public/favicon.svg',
favicons: {
version: appVersion,
appName: 'Nexus Fusion',
appShortName: 'BBP-NF',
appDescription: 'The interface of Blue Brain Nexus, the open-source knowledge graph for data-driven science.',
developerName: 'Blue Brain project',
orientation: 'portrait',
start_url: '/',
icons: {
coast: false,
yandex: false
}
}
}),
],
resolve: {
alias: {
Expand Down
Loading

0 comments on commit b896094

Please sign in to comment.