mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2025-01-03 03:10:04 -05:00
Improve versioning method
This commit is contained in:
parent
06b77d686c
commit
ba35793e03
5 changed files with 14 additions and 6 deletions
2
env.d.ts
vendored
2
env.d.ts
vendored
|
@ -6,6 +6,8 @@ interface ImportMetaEnv {
|
||||||
readonly SAFETWITCH_HTTPS: string
|
readonly SAFETWITCH_HTTPS: string
|
||||||
readonly SAFETWITCH_DEFAULT_LOCALE: string
|
readonly SAFETWITCH_DEFAULT_LOCALE: string
|
||||||
readonly SAFETWITCH_FALLBACK_LOCALE: string
|
readonly SAFETWITCH_FALLBACK_LOCALE: string
|
||||||
|
readonly SAFETWITCH_COMMIT_HASH: string
|
||||||
|
readonly SAFETWITCH_TAG: string
|
||||||
// more env variables...
|
// more env variables...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,16 +3,15 @@ import { inject } from 'vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
const version = inject('version')
|
|
||||||
return {
|
return {
|
||||||
version
|
version: `${import.meta.env.SAFETWITCH_TAG}-${import.meta.env.SAFETWITCH_COMMIT_HASH}`
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="m-2 mt-5 flex justify-center">
|
<div class="m-2 mt-5 flex justify-center">
|
||||||
<p class="text-white font-bold">SafeTwitch v{{ version }}</p>
|
<p class="text-white font-bold">SafeTwitch {{ version}}</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -3,7 +3,6 @@ import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import './assets/index.css'
|
import './assets/index.css'
|
||||||
import i18n from './i18n'
|
import i18n from './i18n'
|
||||||
import { version } from '../package.json'
|
|
||||||
|
|
||||||
const app = createApp(App).use(i18n)
|
const app = createApp(App).use(i18n)
|
||||||
|
|
||||||
|
@ -19,7 +18,6 @@ app.provide('protocol', protocol)
|
||||||
app.provide('rootUrl', `${protocol}${import.meta.env.SAFETWITCH_INSTANCE_DOMAIN}`)
|
app.provide('rootUrl', `${protocol}${import.meta.env.SAFETWITCH_INSTANCE_DOMAIN}`)
|
||||||
app.provide('rootBackendUrl', `${protocol}${import.meta.env.SAFETWITCH_BACKEND_DOMAIN}`)
|
app.provide('rootBackendUrl', `${protocol}${import.meta.env.SAFETWITCH_BACKEND_DOMAIN}`)
|
||||||
app.provide('wsLink', `${wsProtocol}${import.meta.env.SAFETWITCH_BACKEND_DOMAIN}`)
|
app.provide('wsLink', `${wsProtocol}${import.meta.env.SAFETWITCH_BACKEND_DOMAIN}`)
|
||||||
app.provide('version', version)
|
|
||||||
|
|
||||||
import { OhVueIcon, addIcons } from 'oh-vue-icons'
|
import { OhVueIcon, addIcons } from 'oh-vue-icons'
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -43,6 +43,7 @@ export async function getEndpoint(endpoint: string) {
|
||||||
|
|
||||||
export function getDefaultSettings() {
|
export function getDefaultSettings() {
|
||||||
return {
|
return {
|
||||||
|
version: import.meta.env.SAFETWITCH_TAG,
|
||||||
audioOnly: {
|
audioOnly: {
|
||||||
name: 'Audio Only',
|
name: 'Audio Only',
|
||||||
selected: false,
|
selected: false,
|
||||||
|
|
|
@ -4,6 +4,13 @@ import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
||||||
import { dirname, resolve } from 'node:path'
|
import { dirname, resolve } from 'node:path'
|
||||||
|
import { gitDescribeSync } from 'git-describe'
|
||||||
|
|
||||||
|
// Footer version
|
||||||
|
const gitVer = gitDescribeSync()
|
||||||
|
process.env.SAFETWITCH_COMMIT_HASH = gitVer.hash
|
||||||
|
process.env.SAFETWITCH_TAG = gitVer.tag!
|
||||||
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
@ -23,3 +30,4 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
envPrefix: 'SAFETWITCH_',
|
envPrefix: 'SAFETWITCH_',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue