Files
corescope-rx/vite.config.js
efiten 3aa6e1ec2c android: tell on Home when a newer version exists
Google Play updates silently and late, and a GitHub APK never updates by itself. At start
the app asks Play's in-app update API (@capawesome/capacitor-app-update 8.1.1); for a Play
install Play decides, and a tap starts the update in Play. Any other install compares its
version with version.json of its deployment, now written by every web build.
2026-11-11 21:37:10 +01:00

20 lines
690 B
JavaScript

import { defineConfig } from 'vite';
import { readFileSync } from 'fs';
// Inject the package.json version so the app can display which build is running.
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
},
// version.json next to index.html: the Android app reads it from its deployment to
// tell when a newer version is out (src/appupdate.js).
plugins: [{
name: 'version-json',
generateBundle() {
this.emitFile({ type: 'asset', fileName: 'version.json', source: JSON.stringify({ version: pkg.version }) + '\n' });
},
}],
});