feat: show commit id (#331)
parent
4d23fb1467
commit
a96d564eaa
|
@ -1,5 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const buildTime = import.meta.env.__BUILD_TIME__ as string
|
const buildTime = import.meta.env.__BUILD_TIME__ as string
|
||||||
|
const buildCommit = import.meta.env.__BUILD_COMMIT__ as string
|
||||||
const buildTimeDate = new Date(buildTime)
|
const buildTimeDate = new Date(buildTime)
|
||||||
|
|
||||||
const timeAgoOptions = useTimeAgoOptions()
|
const timeAgoOptions = useTimeAgoOptions()
|
||||||
|
@ -46,7 +47,18 @@ const buildTimeAgo = useTimeAgo(buildTime, timeAgoOptions)
|
||||||
<div>
|
<div>
|
||||||
<i18n-t keypath="nav_footer.built_at">
|
<i18n-t keypath="nav_footer.built_at">
|
||||||
<time :datetime="buildTime" :title="$d(buildTimeDate, 'long')">{{ buildTimeAgo }}</time>
|
<time :datetime="buildTime" :title="$d(buildTimeDate, 'long')">{{ buildTimeAgo }}</time>
|
||||||
</i18n-t> · <a href="https://github.com/elk-zone/elk" target="_blank">GitHub</a>
|
</i18n-t>
|
||||||
|
·
|
||||||
|
<NuxtLink
|
||||||
|
v-if="buildCommit"
|
||||||
|
external
|
||||||
|
:href="`https://github.com/elk-zone/elk/commit/${buildCommit}`"
|
||||||
|
target="_blank"
|
||||||
|
font-mono
|
||||||
|
>
|
||||||
|
{{ buildCommit.slice(0, 7) }}
|
||||||
|
</NuxtLink>
|
||||||
|
· <a href="https://github.com/elk-zone/elk" target="_blank">GitHub</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -31,6 +31,7 @@ export default defineNuxtConfig({
|
||||||
vite: {
|
vite: {
|
||||||
define: {
|
define: {
|
||||||
'import.meta.env.__BUILD_TIME__': JSON.stringify(new Date().toISOString()),
|
'import.meta.env.__BUILD_TIME__': JSON.stringify(new Date().toISOString()),
|
||||||
|
'import.meta.env.__BUILD_COMMIT__': JSON.stringify(process.env.COMMIT_REF || ''),
|
||||||
'process.env.VSCODE_TEXTMATE_DEBUG': 'false',
|
'process.env.VSCODE_TEXTMATE_DEBUG': 'false',
|
||||||
'process.mock': ((isDevelopment || (isCI && process.env.PULL_REQUEST === 'true')) && process.env.MOCK_USER) || 'false',
|
'process.mock': ((isDevelopment || (isCI && process.env.PULL_REQUEST === 'true')) && process.env.MOCK_USER) || 'false',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue