Skip to content

Commit

Permalink
add sha and build time to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
danreeves committed Dec 27, 2023
1 parent 95647bf commit 87b9fe2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
23 changes: 19 additions & 4 deletions app/routes/_pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ export default function PageLayout() {

<footer className="mx-auto max-w-7xl px-4 pb-4 pt-6 sm:px-8 lg:px-10">
<div className="flex items-center justify-center gap-4 p-4 rounded-lg border bg-card text-card-foreground shadow-sm">
<a href="https://github.com/danreeves/darkti.de">Source Code</a>
{/* <a href="#TODO">Site Analytics</a> */}
<span className="text-foreground/50">
Build{" "}
<a
className="underline"
href={`https://github.com/danreeves/darkti.de/tree/${GIT_SHA}`}
>
{GIT_SHA}
</a>{" "}
deployed at {BUILD_TIME}
</span>
</div>
</footer>
</div>
Expand Down Expand Up @@ -76,9 +85,15 @@ function Breadcrumbs({ crumbs }: { crumbs: { to: string; label: string }[] }) {
)
}

function Breadcrumb(
{ to, label, last }: { to: string; label: string; last?: boolean },
) {
function Breadcrumb({
to,
label,
last,
}: {
to: string
label: string
last?: boolean
}) {
return (
<li className="flex items-center">
<Link
Expand Down
6 changes: 6 additions & 0 deletions vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference types="vite/client" />

// Global constant replacements https://vitejs.dev/config/shared-options.html#define

declare const BUILD_TIME: string
declare const GIT_SHA: string
7 changes: 7 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { execSync } from "child_process"
import { unstable_vitePlugin as remix } from "@remix-run/dev"
import { defineConfig } from "vite"
import tsconfigPaths from "vite-tsconfig-paths"

export default defineConfig({
plugins: [remix(), tsconfigPaths()],
define: {
BUILD_TIME: JSON.stringify(new Date().toLocaleString("en-GB")),
GIT_SHA: JSON.stringify(
execSync("git rev-parse --short HEAD").toString().trim(),
),
},
})

0 comments on commit 87b9fe2

Please sign in to comment.