22 lines
435 B
TypeScript
22 lines
435 B
TypeScript
const FALLBACK_VERSION = "0.0.1-dev"
|
|
const FALLBACK_SHA = "local"
|
|
|
|
function shortenSha(input: string): string {
|
|
const value = input.trim()
|
|
if (!value) {
|
|
return FALLBACK_SHA
|
|
}
|
|
|
|
return value.slice(0, 7)
|
|
}
|
|
|
|
export function getBuildInfo() {
|
|
const version = process.env.NEXT_PUBLIC_APP_VERSION?.trim() || FALLBACK_VERSION
|
|
const sha = shortenSha(process.env.NEXT_PUBLIC_GIT_SHA ?? "")
|
|
|
|
return {
|
|
version,
|
|
sha,
|
|
}
|
|
}
|