From f72bbe3e1bc17c9ffe29ab2e09a513998ccc4fef Mon Sep 17 00:00:00 2001 From: Mikhail Petrov Date: Wed, 11 Oct 2023 12:17:04 +0300 Subject: [PATCH] Add website version to the page, closes #63 Signed-off-by: Mikhail Petrov --- Makefile | 4 ++++ package.json | 2 +- src/App.js | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 31989ac..b118c09 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ PORT = 3000 NODE_VERSION ?= 14 +VERSION ?= "$(shell git describe --tags --match "v*" --abbrev=8 2>/dev/null | sed -r 's,^v([0-9]+\.[0-9]+)\.([0-9]+)(-.*)?$$,\1 \2 \3,' | while read mm patch suffix; do if [ -z "$$suffix" ]; then echo $$mm.$$patch; else patch=`expr $$patch + 1`; echo $$mm.$${patch}-pre$$suffix; fi; done)" ifeq ($(shell uname), Linux) STAT:=-u $(shell stat -c "%u:%g" .) @@ -60,3 +61,6 @@ docker/%: node:$(NODE_VERSION) sh -c 'make $*' include help.mk + +version: + @echo $(VERSION) diff --git a/package.json b/package.json index a3e1a2b..9633777 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "scripts": { "resolutions": "npx npm-force-resolutions && npm install -D react-error-overlay@6.0.9", - "start": "react-scripts start", + "start": "REACT_APP_VERSION=$(make version) react-scripts start", "build": "BUILD_PATH='./output' react-scripts build", "test": "jest --updateSnapshot", "eject": "react-scripts eject" diff --git a/src/App.js b/src/App.js index f7cec49..ea4e557 100644 --- a/src/App.js +++ b/src/App.js @@ -1480,9 +1480,18 @@ export const App = () => { weight="light" subtitle align="center" + style={{ marginBottom: 0 }} > NeoFS Panel + + {process.env.REACT_APP_VERSION} + );