forked from Mirrors/elk
feat: show commit id (#331)
This commit is contained in:
parent
4d23fb1467
commit
a96d564eaa
2 changed files with 14 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
const buildTime = import.meta.env.__BUILD_TIME__ as string
|
||||
const buildCommit = import.meta.env.__BUILD_COMMIT__ as string
|
||||
const buildTimeDate = new Date(buildTime)
|
||||
|
||||
const timeAgoOptions = useTimeAgoOptions()
|
||||
|
@ -46,7 +47,18 @@ const buildTimeAgo = useTimeAgo(buildTime, timeAgoOptions)
|
|||
<div>
|
||||
<i18n-t keypath="nav_footer.built_at">
|
||||
<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>
|
||||
</footer>
|
||||
</template>
|
||||
|
|
|
@ -31,6 +31,7 @@ export default defineNuxtConfig({
|
|||
vite: {
|
||||
define: {
|
||||
'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.mock': ((isDevelopment || (isCI && process.env.PULL_REQUEST === 'true')) && process.env.MOCK_USER) || 'false',
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue