From 679080c0efcd0231530a6b6b7c8dc1c22c70e267 Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Mon, 13 Nov 2023 14:28:24 +0000 Subject: [PATCH] Add footer bar with git commit metadata --- src/App.svelte | 42 +++++++++++++++++++-------- src/views/TargetManagementView.svelte | 4 +-- tsconfig.node.json | 1 + vite.config.ts | 14 +++++++++ 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 521ce8f..8625c21 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -37,17 +37,6 @@

🍉 Admin Panel

-
- -
@@ -84,6 +73,26 @@
{/if} + diff --git a/src/views/TargetManagementView.svelte b/src/views/TargetManagementView.svelte index 46ed609..c9380d2 100644 --- a/src/views/TargetManagementView.svelte +++ b/src/views/TargetManagementView.svelte @@ -19,7 +19,6 @@ export let equality: (a: T | null, b: T | null) => boolean; let tableKeys: string[] = []; - $: tableKeys = Object.entries($tableData) .filter(x => x[1].client != null || x[1].server != null) .map(x => x[0]) @@ -27,7 +26,6 @@ .sort((a, b) => a.localeCompare(b)); let rowStats: CountStats = {created: 0, modified: 0, removed: 0}; - $: rowStats = tableCountStats($tableData, tableKeys, equality); function domainFilter(src: string, domain: string) { @@ -177,7 +175,7 @@ :global(th), :global(td) { - padding: 11px 8px 11px 8px; + padding: 6px 8px 6px 8px; text-align: center; } } diff --git a/tsconfig.node.json b/tsconfig.node.json index 494bfe0..5258f45 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "target": "ESNext", "composite": true, "skipLibCheck": true, "module": "ESNext", diff --git a/vite.config.ts b/vite.config.ts index 4157534..d1f9d7b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,19 @@ import {defineConfig} from "vite"; import {svelte} from "@sveltejs/vite-plugin-svelte"; +import {exec} from "child_process"; +import {promisify} from "util"; + +// Get current tag/commit and last commit date from git +const pexec = promisify(exec); +let [version, lastmod] = ( + await Promise.allSettled([ + pexec("git describe --tags || git rev-parse --short HEAD"), + pexec('git log -1 --format=%cd --date=format:"%Y-%m-%d %H:%M"'), + ]) +).map(v => (v as {value?: {stdout: string}}).value?.stdout.trim()); + +process.env.VITE_APP_VERSION = version; +process.env.VITE_APP_LASTMOD = lastmod; // https://vitejs.dev/config/ export default defineConfig({