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

View File

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

View File

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