Skip to content

Commit

Permalink
feat: add version display
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Feb 4, 2024
1 parent 641a394 commit f73b579
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/BaseFooter.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div text="gray4" m-5 flex="~ col" justify-center>
<SimpleCopyright />
<div mt-2 text-sm>
<div mt-1 text-sm>
Powered by <a href="https://chat.deepseek.com/" style="color:rgb(10, 122, 255)" target="_blank">DeepSeek</a>
</div>
</div>
Expand Down
20 changes: 20 additions & 0 deletions components/CurrentVersion.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script lang="ts" setup>
import pkg from '~/package.json'
const commitSha = (import.meta.env.VITE_COMMIT_REF || '').slice(0, 7)
const now = import.meta.env.VITE_APP_BUILD_TIME
const buildDate = (new Date(Number.parseInt(now))).toLocaleDateString()
</script>

<template>
<div v-if="commitSha && buildDate" mb-4 text-sm>
<span>
当前版本 v{{ pkg.version }}({{ buildDate }}):
</span>
<span>
<a border="b-1 dashed" :href="`https://github.com/YunYouJun/ai-sfc/commit/${commitSha}`" target="_blank" alt="ai-sfc | GitHub Commit">
{{ commitSha }}
</a>
</span>
</div>
</template>
3 changes: 3 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { pwa } from './config/pwa'
import { appDescription } from './constants/index'

// add build time to env
import.meta.env.VITE_APP_BUILD_TIME = new Date().getTime().toString()

export default defineNuxtConfig({
ssr: false,

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "module",
"version": "0.0.1",
"private": true,
"packageManager": "[email protected]",
"repository": {
Expand Down

0 comments on commit f73b579

Please sign in to comment.