Show version number in footer
This commit is contained in:
parent
845640dc93
commit
0bb47f0368
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
src/version.ts
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
@ -27,6 +27,7 @@
|
||||
"@tailwindcss/forms": "^0.5.10",
|
||||
"@tauri-apps/cli": "^2.6.2",
|
||||
"@types/clusterize.js": "^0.18.3",
|
||||
"@types/node": "^24.3.0",
|
||||
"@vitejs/plugin-vue": "^5.2.4",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"postcss": "^8.5.6",
|
||||
|
26
pnpm-lock.yaml
generated
26
pnpm-lock.yaml
generated
@ -54,9 +54,12 @@ importers:
|
||||
'@types/clusterize.js':
|
||||
specifier: ^0.18.3
|
||||
version: 0.18.3
|
||||
'@types/node':
|
||||
specifier: ^24.3.0
|
||||
version: 24.3.0
|
||||
'@vitejs/plugin-vue':
|
||||
specifier: ^5.2.4
|
||||
version: 5.2.4(vite@5.4.19)(vue@3.5.17(typescript@5.8.3))
|
||||
version: 5.2.4(vite@5.4.19(@types/node@24.3.0))(vue@3.5.17(typescript@5.8.3))
|
||||
autoprefixer:
|
||||
specifier: ^10.4.21
|
||||
version: 10.4.21(postcss@8.5.6)
|
||||
@ -71,7 +74,7 @@ importers:
|
||||
version: 5.8.3
|
||||
vite:
|
||||
specifier: ^5.4.19
|
||||
version: 5.4.19
|
||||
version: 5.4.19(@types/node@24.3.0)
|
||||
vue-tsc:
|
||||
specifier: ^2.2.12
|
||||
version: 2.2.12(typescript@5.8.3)
|
||||
@ -475,6 +478,9 @@ packages:
|
||||
'@types/estree@1.0.8':
|
||||
resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
|
||||
|
||||
'@types/node@24.3.0':
|
||||
resolution: {integrity: sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==}
|
||||
|
||||
'@vitejs/plugin-vue@5.2.4':
|
||||
resolution: {integrity: sha512-7Yx/SXSOcQq5HiiV3orevHUFn+pmMB4cgbEkDYgnkUWb0WfeQ/wa2yFv6D5ICiCQOVpjA7vYDXrC7AGO8yjDHA==}
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
@ -977,6 +983,9 @@ packages:
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
undici-types@7.10.0:
|
||||
resolution: {integrity: sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==}
|
||||
|
||||
update-browserslist-db@1.1.3:
|
||||
resolution: {integrity: sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==}
|
||||
hasBin: true
|
||||
@ -1323,9 +1332,13 @@ snapshots:
|
||||
|
||||
'@types/estree@1.0.8': {}
|
||||
|
||||
'@vitejs/plugin-vue@5.2.4(vite@5.4.19)(vue@3.5.17(typescript@5.8.3))':
|
||||
'@types/node@24.3.0':
|
||||
dependencies:
|
||||
vite: 5.4.19
|
||||
undici-types: 7.10.0
|
||||
|
||||
'@vitejs/plugin-vue@5.2.4(vite@5.4.19(@types/node@24.3.0))(vue@3.5.17(typescript@5.8.3))':
|
||||
dependencies:
|
||||
vite: 5.4.19(@types/node@24.3.0)
|
||||
vue: 3.5.17(typescript@5.8.3)
|
||||
|
||||
'@volar/language-core@2.4.15':
|
||||
@ -1865,6 +1878,8 @@ snapshots:
|
||||
|
||||
typescript@5.8.3: {}
|
||||
|
||||
undici-types@7.10.0: {}
|
||||
|
||||
update-browserslist-db@1.1.3(browserslist@4.25.1):
|
||||
dependencies:
|
||||
browserslist: 4.25.1
|
||||
@ -1873,12 +1888,13 @@ snapshots:
|
||||
|
||||
util-deprecate@1.0.2: {}
|
||||
|
||||
vite@5.4.19:
|
||||
vite@5.4.19(@types/node@24.3.0):
|
||||
dependencies:
|
||||
esbuild: 0.21.5
|
||||
postcss: 8.5.6
|
||||
rollup: 4.44.1
|
||||
optionalDependencies:
|
||||
'@types/node': 24.3.0
|
||||
fsevents: 2.3.3
|
||||
|
||||
vscode-uri@3.1.0: {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
DrCr: Web-based double-entry bookkeeping framework
|
||||
DrCr: Double-entry bookkeeping framework
|
||||
Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@ -32,6 +32,7 @@
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<FooterBar />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -39,6 +40,7 @@
|
||||
import { onErrorCaptured } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import FooterBar from './components/FooterBar.vue';
|
||||
import HeaderBar from './components/HeaderBar.vue';
|
||||
import { db } from './db.js';
|
||||
import { error, handleCriticalError } from './error.js';
|
||||
|
31
src/components/FooterBar.vue
Normal file
31
src/components/FooterBar.vue
Normal file
@ -0,0 +1,31 @@
|
||||
<!--
|
||||
DrCr: Double-entry bookkeeping framework
|
||||
Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<template>
|
||||
<footer class="print:hidden">
|
||||
<div class="mx-auto max-w-7xl px-6 lg:px-8">
|
||||
<div class="border-t border-gray-200 py-4 text-center text-sm text-gray-500 sm:text-left">
|
||||
DrCr (build {{ COMMIT_HASH }})
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { COMMIT_HASH } from '../version.ts';
|
||||
</script>
|
@ -1,12 +1,27 @@
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
|
||||
// @ts-expect-error process is a nodejs global
|
||||
import * as child from "child_process";
|
||||
import * as fs from "node:fs";
|
||||
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(async () => ({
|
||||
plugins: [vue()],
|
||||
plugins: [
|
||||
vue(),
|
||||
{
|
||||
// Update version.ts when frontend built
|
||||
name: "update-version",
|
||||
async buildStart(options) {
|
||||
// Get commit from git
|
||||
const commitHash = child.execSync("git rev-parse --short HEAD").toString().trim();
|
||||
|
||||
// Write to src/version.ts
|
||||
fs.writeFileSync("src/version.ts", "export const COMMIT_HASH = " + JSON.stringify(commitHash) + ";");
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user