From 1bf315ebdf6c39fe046873ca56462b85bd2e6c83 Mon Sep 17 00:00:00 2001
From: Przemek Wiech
Date: Tue, 26 Nov 2019 23:43:52 +0100
Subject: [PATCH] Added build version to the intro screen
---
package.json | 4 ++--
src/index.css | 4 ++++
src/intro.tsx | 18 ++++++++++++++++++
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 1bb2cce..d16c69e 100644
--- a/package.json
+++ b/package.json
@@ -48,8 +48,8 @@
"typescript": "latest"
},
"scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
+ "start": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` REACT_APP_GIT_TIME=`git log -1 --format=%ci` react-scripts start",
+ "build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` REACT_APP_GIT_TIME=`git log -1 --format=%ci` react-scripts build",
"test": "react-scripts test --env=jsdom",
"prettier": "prettier --write src/**/*.{ts,tsx,json}",
"predeploy": "npm run build",
diff --git a/src/index.css b/src/index.css
index 8d5e246..7982407 100644
--- a/src/index.css
+++ b/src/index.css
@@ -51,3 +51,7 @@ div.ui.card.intro {
width: 600px;
margin: auto;
}
+
+.version {
+ color: #888;
+}
\ No newline at end of file
diff --git a/src/intro.tsx b/src/intro.tsx
index f55b979..597def5 100644
--- a/src/intro.tsx
+++ b/src/intro.tsx
@@ -15,6 +15,13 @@ function GedcomLink(props: {url: string; text: string}) {
);
}
+function formatBuildDate(dateString: string) {
+ return new Date(dateString)
+ .toISOString()
+ .slice(0, 16)
+ .replace('T', ' ');
+}
+
/** The intro page. */
export function Intro() {
return (
@@ -111,6 +118,17 @@ export function Intro() {
}}
/>
+
+ version: {formatBuildDate(process.env.REACT_APP_GIT_TIME!)} (
+
+ {process.env.REACT_APP_GIT_SHA}
+
+ )
+
);