From 72a3bb28fcf7e7ac1eee57cc100b122c6ba74141 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Thu, 13 Aug 2026 21:55:42 +0100 Subject: [PATCH 1/2] fix(webapp): show the real app version instead of v0.0.0 in organization settings The Vite SSR bundle resolves workspace packages to TS source, where the VERSION constant is the unstamped 0.0.0 placeholder; the stamping script only patches dist output, which the bundle never reads. A small Vite plugin now performs the same substitution on the source version modules of core and trigger-sdk during bundling, so the settings page and the version headers the webapp sends carry the real version again. --- .server-changes/org-settings-app-version.md | 6 ++++ apps/webapp/vite.config.ts | 38 ++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .server-changes/org-settings-app-version.md diff --git a/.server-changes/org-settings-app-version.md b/.server-changes/org-settings-app-version.md new file mode 100644 index 0000000000..43ae2cc5c3 --- /dev/null +++ b/.server-changes/org-settings-app-version.md @@ -0,0 +1,6 @@ +--- +area: webapp +type: fix +--- + +The app version shown on the organization settings page now reports the real version instead of v0.0.0. diff --git a/apps/webapp/vite.config.ts b/apps/webapp/vite.config.ts index 2dcdf2d47c..995e378d17 100644 --- a/apps/webapp/vite.config.ts +++ b/apps/webapp/vite.config.ts @@ -1,7 +1,42 @@ +import { readFileSync } from "node:fs"; import { vitePlugin as remix } from "@remix-run/dev"; -import { defaultClientConditions, defaultServerConditions, defineConfig } from "vite"; +import { defaultClientConditions, defaultServerConditions, defineConfig, type Plugin } from "vite"; import tsconfigPaths from "vite-tsconfig-paths"; +const packageVersions: Record = Object.fromEntries( + ["core", "trigger-sdk"].map((pkg) => [ + pkg, + ( + JSON.parse( + readFileSync(new URL(`../../packages/${pkg}/package.json`, import.meta.url), "utf-8") + ) as { version: string } + ).version, + ]) +); + +/** + * The `@triggerdotdev/source` condition resolves workspace packages to TS source, where + * each VERSION constant is the "0.0.0" placeholder (scripts/updateVersion.ts stamps the + * real version, but only in dist output, which this bundle never reads). Stamp the version + * modules during bundling so VERSION carries the real package version everywhere it's used. + */ +function stampPackageVersions(): Plugin { + return { + name: "stamp-package-versions", + transform(code, id) { + const match = id + .split("?")[0] + .match(/packages[\/\\](core|trigger-sdk)[\/\\]src[\/\\]version\.ts$/); + if (match) { + return { + code: code.replace('"0.0.0"', JSON.stringify(packageVersions[match[1]])), + map: null, + }; + } + }, + }; +} + export default defineConfig({ plugins: [ remix({ @@ -10,6 +45,7 @@ export default defineConfig({ serverBuildFile: "index.mjs", }), tsconfigPaths(), + stampPackageVersions(), ], resolve: { // Resolve workspace packages to TS source (same condition the CLI uses) From 2bd65038a640f95cdd1229653baa067d976fc92f Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 14 Aug 2026 10:30:09 +0100 Subject: [PATCH 2/2] fix(webapp): drop unnecessary regex escapes flagged by lint --- apps/webapp/vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/webapp/vite.config.ts b/apps/webapp/vite.config.ts index 995e378d17..56ddae17c0 100644 --- a/apps/webapp/vite.config.ts +++ b/apps/webapp/vite.config.ts @@ -26,7 +26,7 @@ function stampPackageVersions(): Plugin { transform(code, id) { const match = id .split("?")[0] - .match(/packages[\/\\](core|trigger-sdk)[\/\\]src[\/\\]version\.ts$/); + .match(/packages[/\\](core|trigger-sdk)[/\\]src[/\\]version\.ts$/); if (match) { return { code: code.replace('"0.0.0"', JSON.stringify(packageVersions[match[1]])),