my website at ewancroft.uk
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(footer): display git commit hash alongside version

+47 -12
+1
src/app.d.ts
··· 11 11 } 12 12 13 13 declare const __APP_VERSION__: string; 14 + declare const __GIT_COMMIT__: string; 14 15 15 16 export {};
+35 -11
src/lib/components/layout/Footer.svelte
··· 4 4 import type { ProfileData, SiteInfoData } from '$lib/services/atproto'; 5 5 import DecimalClock from './DecimalClock.svelte'; 6 6 import { happyMacStore } from '$lib/stores'; 7 + import { Code } from '@lucide/svelte'; 7 8 8 9 let profile: ProfileData | null = $state(null); 9 10 let siteInfo: SiteInfoData | null = $state(null); ··· 82 83 {/if} 83 84 </div> 84 85 85 - <!-- Line 2: Powered by & Code --> 86 + <!-- Line 2: Powered by, Code, Version --> 86 87 <div class="flex flex-col flex-wrap items-center gap-1 sm:flex-row sm:gap-2 md:items-start"> 87 - <span 88 - >Powered by <a 88 + <span> 89 + Powered by <a 89 90 href="https://atproto.com/guides/glossary#at-protocol" 90 91 class="underline hover:text-primary-500 focus-visible:text-primary-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:hover:text-primary-400 dark:focus-visible:text-primary-400" 91 92 target="_blank" 92 93 rel="noopener noreferrer">atproto</a 93 - ></span 94 - > 94 + > 95 + </span> 96 + 95 97 <a 96 98 href="https://github.com/ewanc26/website" 97 99 target="_blank" 98 100 rel="noopener noreferrer" 99 101 class="underline hover:text-primary-500 focus-visible:text-primary-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:hover:text-primary-400 dark:focus-visible:text-primary-400" 100 - aria-label="View source code on GitHub">code</a 102 + aria-label="View source code on GitHub" 101 103 > 102 - <!-- Line 3: Version number (click 24 times for easter egg!) --> 104 + code 105 + </a> 106 + </div> 107 + 108 + <!-- Line 3: Commit hash --> 109 + <div 110 + class="flex items-center justify-center gap-2 text-sm text-ink-700 md:justify-start dark:text-ink-300" 111 + > 112 + <Code class="h-4 w-4 opacity-70" /> 113 + 103 114 <button 104 115 type="button" 105 116 onclick={() => happyMacStore.incrementClick()} 106 - class="cursor-default transition-colors select-none hover:text-ink-600 dark:hover:text-ink-300" 117 + class="transition-colors hover:text-ink-900 dark:hover:text-ink-100" 107 118 aria-label="Version {__APP_VERSION__}{showHint 108 119 ? ` - ${$happyMacStore.clickCount} of 24 clicks` 109 120 : ''}" 110 121 title={showHint ? `${$happyMacStore.clickCount}/24` : ''} 111 122 > 112 - v{__APP_VERSION__}{#if showHint}<span class="ml-1 text-xs opacity-60" 113 - >({$happyMacStore.clickCount}/24)</span 114 - >{/if} 123 + v{__APP_VERSION__} 124 + {#if showHint} 125 + <span class="ml-1 text-xs opacity-60"> 126 + ({$happyMacStore.clickCount}/24) 127 + </span> 128 + {/if} 115 129 </button> 130 + 131 + <a 132 + href="https://github.com/ewanc26/website/commit/{__GIT_COMMIT__}" 133 + target="_blank" 134 + rel="noopener noreferrer" 135 + class="font-mono text-xs opacity-60 transition-colors hover:text-primary-500 hover:opacity-100 focus-visible:text-primary-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:hover:text-primary-400 dark:focus-visible:text-primary-400" 136 + aria-label="View commit {__GIT_COMMIT__} on GitHub" 137 + > 138 + #{__GIT_COMMIT__} 139 + </a> 116 140 </div> 117 141 </div> 118 142
+11 -1
vite.config.ts
··· 2 2 import { sveltekit } from '@sveltejs/kit/vite'; 3 3 import { defineConfig } from 'vite'; 4 4 import { version } from './package.json'; 5 + import { execSync } from 'node:child_process'; 6 + 7 + const gitCommit = (() => { 8 + try { 9 + return execSync('git rev-parse --short HEAD').toString().trim(); 10 + } catch { 11 + return 'unknown'; 12 + } 13 + })(); 5 14 6 15 export default defineConfig({ 7 16 plugins: [tailwindcss(), sveltekit()], 8 17 define: { 9 - __APP_VERSION__: JSON.stringify(version) 18 + __APP_VERSION__: JSON.stringify(version), 19 + __GIT_COMMIT__: JSON.stringify(gitCommit) 10 20 }, 11 21 12 22