Skip to content

Commit 478ef35

Browse files
add app version metadata
1 parent eb1ca40 commit 478ef35

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

demos/react-supabase-todolist/src/components/providers/SystemProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { createBaseLogger, DifferentialWatchedQuery, LogLevel, PowerSyncDatabase
77
import React, { Suspense } from 'react';
88
import { NavigationPanelContextProvider } from '../navigation/NavigationPanelContext';
99

10+
declare const APP_VERSION: string;
11+
1012
const SupabaseContext = React.createContext<SupabaseConnector | null>(null);
1113
export const useSupabase = () => React.useContext(SupabaseContext);
1214

@@ -70,7 +72,7 @@ export const SystemProvider = ({ children }: { children: React.ReactNode }) => {
7072
sessionStarted: () => {
7173
powerSync.connect(connector, {
7274
appMetadata: {
73-
app_version: '1.0.0'
75+
app_version: APP_VERSION
7476
}
7577
});
7678
}

demos/react-supabase-todolist/vite.config.mts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import wasm from 'vite-plugin-wasm';
2-
import topLevelAwait from 'vite-plugin-top-level-await';
31
import { fileURLToPath, URL } from 'url';
2+
import topLevelAwait from 'vite-plugin-top-level-await';
3+
import wasm from 'vite-plugin-wasm';
44

5-
import { defineConfig } from 'vite';
65
import react from '@vitejs/plugin-react';
6+
import { defineConfig } from 'vite';
77
import { VitePWA } from 'vite-plugin-pwa';
88

99
// https://vitejs.dev/config/
@@ -19,6 +19,9 @@ export default defineConfig({
1919
resolve: {
2020
alias: [{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) }]
2121
},
22+
define: {
23+
APP_VERSION: JSON.stringify(process.env.npm_package_version)
24+
},
2225
publicDir: '../public',
2326
envDir: '..', // Use this dir for env vars, not 'src'.
2427
optimizeDeps: {

0 commit comments

Comments
 (0)