Skip to content

Commit 6d9efab

Browse files
fix(app): inject OPENCODE_VERSION into web UI bundle at build time
1 parent d704fe5 commit 6d9efab

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/app/src/entry.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const clearAuthToken = () => {
121121

122122
const platform: Platform = {
123123
platform: "web",
124-
version: pkg.version,
124+
version: import.meta.env.VITE_OPENCODE_VERSION || pkg.version,
125125
openLink,
126126
back,
127127
forward,

packages/app/src/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ interface ImportMetaEnv {
22
readonly VITE_OPENCODE_SERVER_HOST: string
33
readonly VITE_OPENCODE_SERVER_PORT: string
44
readonly VITE_OPENCODE_CHANNEL?: "dev" | "beta" | "prod"
5+
readonly VITE_OPENCODE_VERSION: string
56

67
readonly VITE_SENTRY_DSN?: string
78
readonly VITE_SENTRY_ENVIRONMENT?: string

packages/app/vite.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const channel = (() => {
1212
return "dev"
1313
})()
1414

15+
const version = process.env.OPENCODE_VERSION ?? ""
16+
1517
/**
1618
* @type {import("vite").PluginOption}
1719
*/
@@ -27,6 +29,7 @@ export default [
2729
},
2830
define: {
2931
"import.meta.env.VITE_OPENCODE_CHANNEL": JSON.stringify(channel),
32+
"import.meta.env.VITE_OPENCODE_VERSION": JSON.stringify(version),
3033
},
3134
worker: {
3235
format: "es",

0 commit comments

Comments
 (0)