feat: show version on start page

This commit is contained in:
Settel 2022-07-29 16:23:57 +02:00
parent 72d61d7811
commit 0f517c5180
3 changed files with 24 additions and 2 deletions

View File

@ -1,4 +1,7 @@
import { defineNuxtConfig } from 'nuxt' import { defineNuxtConfig } from 'nuxt'
import fs from 'fs'
const packageJson = fs.readFileSync('./package.json', 'utf-8')
const version = JSON.parse(packageJson).version || 0
export default defineNuxtConfig({ export default defineNuxtConfig({
ssr: false, ssr: false,
@ -10,6 +13,10 @@ export default defineNuxtConfig({
buildModules: [ buildModules: [
'@pinia/nuxt' '@pinia/nuxt'
], ],
publicRuntimeConfig: {
serverBaseUrl: '/',
version,
},
proxy: { proxy: {
'/api/': 'http://localhost:32039', '/api/': 'http://localhost:32039',
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "knowyt", "name": "knowyt",
"version": "1.21", "version": "2.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "nuxt build", "build": "nuxt build",

View File

@ -12,9 +12,17 @@
</div> </div>
<div class="page-index__space" /> <div class="page-index__space" />
</div> </div>
<div class="page-index__copyright-notice">
v{{ config.version }}, © 2021-2022, Settel
</div>
</div> </div>
</template> </template>
<script setup lang="ts">
import { useRuntimeConfig } from '#app'
const config = useRuntimeConfig()
</script>
<style lang="scss"> <style lang="scss">
@import '~/assets/css/components'; @import '~/assets/css/components';
@ -47,5 +55,12 @@ body {
&__space { &__space {
flex-grow: 1; flex-grow: 1;
} }
&__copyright-notice {
position: absolute;
right: 1em;
bottom: 0;
color: #000000;
}
} }
</style> </style>