mirror of
https://github.com/efiten/coredrive-rx.git
synced 2026-11-23 12:57:58 +00:00
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.
20 lines
690 B
JavaScript
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' });
|
|
},
|
|
}],
|
|
});
|