Add app version management, update checks, and periodic SW updates
- Introduced version.json and appVersionAssetPlugin for build-time version tracking. - Enhanced settings page with update check/status UI. - Refactored bootstrap to handle SW updates and initiate periodic checks.
This commit is contained in:
@@ -1,10 +1,32 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import packageJson from './package.json';
|
||||
|
||||
function appVersionAssetPlugin() {
|
||||
return {
|
||||
name: 'app-version-asset',
|
||||
apply: 'build',
|
||||
generateBundle() {
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
fileName: 'version.json',
|
||||
source: JSON.stringify(
|
||||
{
|
||||
version: packageJson.version,
|
||||
buildTime: new Date().toISOString(),
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(packageJson.version),
|
||||
},
|
||||
plugins: [appVersionAssetPlugin()],
|
||||
server: {
|
||||
port: 4173,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user