Show the build version in the footer
This commit is contained in:
1 parent
4e8a68c330
commit
66eccec274
2 files changed
+30
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const appConfig = useAppConfig()
|
const appConfig = useAppConfig()
|
||||||
|
const { buildVersion, buildVersionUrl } = useRuntimeConfig().public
|
||||||
const { forced: forcedColorMode } = useDocusColorMode()
|
const { forced: forcedColorMode } = useDocusColorMode()
|
||||||
|
|
||||||
interface FooterLink {
|
interface FooterLink {
|
||||||
@@ -44,6 +45,21 @@ const links = computed<FooterLink[]>(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<template v-if="buildVersion">
|
||||||
|
<a
|
||||||
|
v-if="buildVersionUrl"
|
||||||
|
:href="buildVersionUrl"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
class="text-xs text-muted tabular-nums hover:text-default"
|
||||||
|
title="Build version, see the change behind it"
|
||||||
|
>v{{ buildVersion }}</a>
|
||||||
|
<span
|
||||||
|
v-else
|
||||||
|
class="text-xs text-muted tabular-nums"
|
||||||
|
title="Build version"
|
||||||
|
>v{{ buildVersion }}</span>
|
||||||
|
</template>
|
||||||
<template v-if="links.length">
|
<template v-if="links.length">
|
||||||
<UButton
|
<UButton
|
||||||
v-for="(link, index) of links"
|
v-for="(link, index) of links"
|
||||||
|
|||||||
@@ -67,6 +67,15 @@ function scanContentIcons(): { collections: string[], icons: string[] } {
|
|||||||
}
|
}
|
||||||
const contentIcons = scanContentIcons()
|
const contentIcons = scanContentIcons()
|
||||||
|
|
||||||
|
// Version shown in the footer. It is the release number of the production
|
||||||
|
// image (1.0.31, ...), decided by the docudjeex-build workflow, which passes
|
||||||
|
// it as BUILD_VERSION when it builds the image. Left empty everywhere else
|
||||||
|
// (dev, local builds, CI builds that are not published), and the footer then
|
||||||
|
// shows nothing.
|
||||||
|
function buildVersion(): string {
|
||||||
|
return (process.env.BUILD_VERSION || '').trim()
|
||||||
|
}
|
||||||
|
|
||||||
// ProseImg (app/components/content/ProseImg.vue) caps every markdown image
|
// ProseImg (app/components/content/ProseImg.vue) caps every markdown image
|
||||||
// at 1280px wide, but NuxtImg's `width` prop always becomes the rendered
|
// at 1280px wide, but NuxtImg's `width` prop always becomes the rendered
|
||||||
// <img>'s HTML width attribute too, not just the resize target. Passing
|
// <img>'s HTML width attribute too, not just the resize target. Passing
|
||||||
@@ -191,6 +200,11 @@ export default defineNuxtConfig({
|
|||||||
// Read by ProseImg to cap each image's width at its own real size
|
// Read by ProseImg to cap each image's width at its own real size
|
||||||
// instead of always requesting (and rendering) 1280px.
|
// instead of always requesting (and rendering) 1280px.
|
||||||
imageWidths: scanImageWidths(),
|
imageWidths: scanImageWidths(),
|
||||||
|
// Shown in the footer (AppFooterRight), changes at every production build.
|
||||||
|
buildVersion: buildVersion(),
|
||||||
|
// Where the version links to: the pull request behind the build, set by
|
||||||
|
// the same workflow (BUILD_VERSION_URL). The version stays plain text without it.
|
||||||
|
buildVersionUrl: (process.env.BUILD_VERSION_URL || '').trim(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
|
|||||||
Reference in new issue
Block a user