Skip to content

Commit 85794a2

Browse files
committed
fix(versie): toon CalVer-tag op standalone /zonder-account/
Het standalone formulier op /zonder-account/ toonde in productie "ontwikkel (commit ...)" in plaats van de release-versie (bijv. v2026.6.20), terwijl de statuspagina die wel correct toont. Oorzaak: de statuspagina leest version.json op runtime (door de productie-overlay herschreven met de tag), maar het standalone formulier bakt de versie op build-time in. De frontend-Containerfile bouwt het zonder RELEASE_TAG (die bestaat nog niet bij de acceptatie-build) en productie promoot dat image zonder herbouw, dus bleef de tag 'dev'. Fix: de volledige versiestring wordt nu als één string-literal in de single-file HTML gebakken (__APP_VERSION__), zodat de productie-overlay de "ontwikkel (commit <sha>)"-marker met de CalVer-tag kan vervangen -- net zoals version.json al gepatcht wordt. Geen runtime-fetch, blijft volledig offline-puur. Acceptatie blijft bewust de commit tonen.
1 parent c4ae1f5 commit 85794a2

7 files changed

Lines changed: 34 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ build) staan kort onder "Onder de motorkap".
1313

1414
## [Unreleased]
1515

16+
### Opgelost
17+
18+
* Het standalone formulier op `/zonder-account/` toonde in productie
19+
"ontwikkel" met een commit in plaats van de release-versie; het laat nu
20+
dezelfde versie zien als de statuspagina.
21+
1622
## [2026.6.20] - 2026-06-20
1723

1824
### Toegevoegd

apps/standalone-form/env.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/// <reference types="vite/client" />
22

3-
declare const __APP_TAG__: string
4-
declare const __APP_COMMIT__: string
3+
declare const __APP_VERSION__: string

apps/standalone-form/src/components/LandingView.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
22
import { computed, ref } from 'vue'
33
import { AppBanner, UiButton, ExportPdfInfo, FormType, type NavigationFunctions } from '@overheid-assessment/core'
4-
import { formatBuildVersion } from '@/version'
54
65
const props = defineProps<{
76
navigation: NavigationFunctions
@@ -12,7 +11,7 @@ const emit = defineEmits<{
1211
startFresh: [type: FormType]
1312
}>()
1413
15-
const appVersion = formatBuildVersion(__APP_TAG__, __APP_COMMIT__)
14+
const appVersion = __APP_VERSION__
1615
1716
interface AssessmentCard {
1817
type: FormType

apps/standalone-form/src/version.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
// Build-time version constants (__APP_TAG__/__APP_COMMIT__) are injected via
2-
// Vite `define`; both default to the sentinel 'dev' when not baked in. The
3-
// channel is derived from those signals: a CalVer tag means a release, an
4-
// untagged build with a real commit is a development build, and the bare
5-
// local build has neither.
1+
// Formats the display version from a build-time tag and commit, both defaulting
2+
// to the sentinel 'dev' when not baked in. Called by vite.config.ts to inline
3+
// the result as __APP_VERSION__. The channel is derived from those signals: a
4+
// CalVer tag means a release, an untagged build with a real commit is a
5+
// development build, and the bare local build has neither.
6+
//
7+
// The untagged form deliberately renders as "ontwikkel (commit <7-hex>)" so the
8+
// production overlay (containers/frontend/overlay.Dockerfile) can sed-replace it
9+
// with the CalVer tag, which is unknown when the acceptatie image is built.
610
export function formatBuildVersion(tag: string, commit: string): string {
711
if (tag !== 'dev') return tag
812
if (commit !== 'dev') return `ontwikkel (commit ${commit})`

apps/standalone-form/vite.config.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ import { defineConfig, type Plugin } from 'vite'
44
import vue from '@vitejs/plugin-vue'
55
import vueDevTools from 'vite-plugin-vue-devtools'
66
import { viteSingleFile } from 'vite-plugin-singlefile'
7+
import { formatBuildVersion } from './src/version'
8+
9+
// Resolve the full display version at build time so it lands in the single-file
10+
// bundle as one string literal. The production overlay (containers/frontend/
11+
// overlay.Dockerfile) can then sed-replace the baked "ontwikkel (commit …)"
12+
// marker with the CalVer tag, since the tag is unknown when this image is built.
13+
const appVersion = formatBuildVersion(
14+
process.env.RELEASE_TAG ?? 'dev',
15+
(process.env.GIT_SHA ?? 'dev').slice(0, 7),
16+
)
717

818
/** Inline favicon as data-URI in built HTML so the output is truly a single file. */
919
function inlineFavicon(): Plugin {
@@ -49,8 +59,7 @@ export default defineConfig(({ mode }) => ({
4959
],
5060
base: '/',
5161
define: {
52-
__APP_TAG__: JSON.stringify(process.env.RELEASE_TAG ?? 'dev'),
53-
__APP_COMMIT__: JSON.stringify((process.env.GIT_SHA ?? 'dev').slice(0, 7)),
62+
__APP_VERSION__: JSON.stringify(appVersion),
5463
},
5564
resolve: {
5665
alias: {

apps/standalone-form/vitest.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import vue from '@vitejs/plugin-vue'
88
export default defineConfig({
99
plugins: [vue()],
1010
define: {
11-
__APP_TAG__: JSON.stringify('v2026.6.14'),
12-
__APP_COMMIT__: JSON.stringify('abc1234'),
11+
__APP_VERSION__: JSON.stringify('v2026.6.14'),
1312
},
1413
resolve: {
1514
alias: {

containers/frontend/overlay.Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ ARG TAG=dev
44
ARG COMMIT=dev
55
USER root
66
RUN printf '{"version":"%s","commit":"%s","channel":"productie"}\n' "$TAG" "$COMMIT" > /usr/share/nginx/html/version.json
7+
# The standalone form bakes its version into the single-file HTML at build time,
8+
# when the CalVer tag isn't known yet. Patch the baked "ontwikkel (commit <sha>)"
9+
# marker with the release tag so /zonder-account/ shows the same version as the
10+
# status page.
11+
RUN sed -i "s|ontwikkel (commit [0-9a-f]\{7\})|${TAG}|g" /usr/share/nginx/html/zonder-account/index.html
712
USER 101

0 commit comments

Comments
 (0)