Add builds

This commit is contained in:
Matt DiMeglio 2025-06-12 12:57:25 -04:00
parent 1f82aef968
commit 0e696e05cc
3 changed files with 22 additions and 1 deletions

View file

@ -7,6 +7,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=WDXL+Lubrifont+TC&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=WDXL+Lubrifont+TC&display=swap" rel="stylesheet">
<script src="/hmr-runtime-inject.js"></script> <script src="/hmr-runtime-inject.js"></script>
<script>window.APP_VERSION = "__appVersion__";</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ShiftSync</title> <title>ShiftSync</title>
</head> </head>

View file

@ -69,6 +69,16 @@ const AppRouter = () => {
}; };
useEffect(() => { useEffect(() => {
const localVersion = localStorage.getItem("APP_VERSION");
const currentVersion = window.APP_VERSION;
if (localVersion && localVersion !== currentVersion) {
console.log("Version changed, forcing reload");
localStorage.setItem("APP_VERSION", currentVersion);
window.location.reload(true); // force full page reload
} else {
localStorage.setItem("APP_VERSION", currentVersion);
}
fetchAPI(); fetchAPI();
// await call for getting the count of employees and any other calls to db. // await call for getting the count of employees and any other calls to db.

View file

@ -1,10 +1,20 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import path from 'path'; import path from 'path';
import pkg from './package.json';
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [
react(),
{
name: 'html-transform',
transformIndexHtml(html) {
return html
.replace(/__appVersion__/g, pkg.version)
}
}
],
server:{ server:{
host: true, host: true,
allowedHosts: true, allowedHosts: true,