Merged in chore/fix-semver (pull request #3393)

Chore/fix semver

* fix semver versioning

* fix semver versioning

* Merge branch 'chore/fix-semver' of bitbucket.org:scandic-swap/web into chore/fix-semver

* Merge branch 'master' of bitbucket.org:scandic-swap/web into chore/fix-semver

* reset to master


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2026-01-07 10:49:14 +00:00
parent ffef566316
commit 1ba94ff70a
8 changed files with 111 additions and 8 deletions

View File

@@ -1,11 +1,16 @@
import { createEnv } from "@t3-oss/env-nextjs"
import { z } from "zod"
import { getSemver } from "@scandic-hotels/common/utils/getSemver"
export const env = createEnv({
client: {
NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().default("development"),
NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: z.coerce.number().default(0.001),
NEXT_PUBLIC_RELEASE_TAG: z.string().optional(),
NEXT_PUBLIC_RELEASE_TAG: z
.string()
.optional()
.transform((s) => getSemver(s, process.env.BRANCH || "development")),
},
emptyStringAsUndefined: true,
runtimeEnv: {

View File

@@ -1,6 +1,8 @@
import { createEnv } from "@t3-oss/env-nextjs"
import { z } from "zod"
import { getSemver } from "@scandic-hotels/common/utils/getSemver"
export const env = createEnv({
/**
* Due to t3-env only checking typeof window === "undefined"
@@ -36,7 +38,10 @@ export const env = createEnv({
.refine((s) => s === "true" || s === "false")
.transform((s) => s === "true")
.default("false"),
RELEASE_TAG: z.string().optional(),
RELEASE_TAG: z
.string()
.optional()
.transform((s) => getSemver(s, process.env.BRANCH || "development")),
},
emptyStringAsUndefined: true,
runtimeEnv: {

View File

@@ -27,12 +27,12 @@ export function EnvironmentWatermark() {
}
const { environment, name } = getEnvironmentName()
const displayValues = [name]
if (name !== environment) {
displayValues.push(`(${environment})`)
}
const displayValues: string[] = [environment]
if (env.NEXT_PUBLIC_RELEASE_TAG) {
displayValues.push(`[${env.NEXT_PUBLIC_RELEASE_TAG}]`)
} else if (name !== environment) {
displayValues.push(`(${name})`)
}
return (

View File

@@ -1,6 +1,8 @@
import { createEnv } from "@t3-oss/env-nextjs"
import { z } from "zod"
import { getSemver } from "@scandic-hotels/common/utils/getSemver"
export const env = createEnv({
client: {
NEXT_PUBLIC_NODE_ENV: z.enum(["development", "test", "production"]),
@@ -8,7 +10,10 @@ export const env = createEnv({
NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().default("development"),
NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: z.coerce.number().default(0.001),
NEXT_PUBLIC_PUBLIC_URL: z.string().optional(),
NEXT_PUBLIC_RELEASE_TAG: z.string().optional(),
NEXT_PUBLIC_RELEASE_TAG: z
.string()
.optional()
.transform((s) => getSemver(s, process.env.BRANCH || "development")),
},
emptyStringAsUndefined: true,
runtimeEnv: {

View File

@@ -1,6 +1,8 @@
import { createEnv } from "@t3-oss/env-nextjs"
import { z } from "zod"
import { getSemver } from "@scandic-hotels/common/utils/getSemver"
export const env = createEnv({
/**
* Due to t3-env only checking typeof window === "undefined"
@@ -112,7 +114,10 @@ export const env = createEnv({
.refine((s) => s === "true" || s === "false")
.transform((s) => s === "true")
.default("false"),
RELEASE_TAG: z.string().optional(),
RELEASE_TAG: z
.string()
.optional()
.transform((s) => getSemver(s, process.env.BRANCH || "development")),
},
emptyStringAsUndefined: true,
runtimeEnv: {