From d765e666b730c9845b471cbc71512535529db376 Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Mon, 26 Aug 2024 12:36:34 -0400 Subject: [PATCH] Displaying game version --- package.json | 2 +- src/map.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ae46640..e5da913 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitterra", - "version": "1.2.4", + "version": "1.2.6", "description": "A git-based game running in CI/CD and played by coding", "main": "src/generateMap.js", "scripts": { diff --git a/src/map.js b/src/map.js index d448510..2cbff82 100644 --- a/src/map.js +++ b/src/map.js @@ -6,6 +6,10 @@ import { languageStringToHexColor, } from "./languages.js"; +const version = fs.existsSync("../package.json") + ? JSON.parse(fs.readFileSync("../package.json")).version + : null; + /** * This function defines the algorythm for plotting city blocks maintaining the diamond shape. * The input is a sequential number of the block and the output are @@ -517,6 +521,12 @@ export const generateMapHTML = function (gameConfig, history) { width: 15em; } + #version { + display: block; + margin-top: -1.3em; + font-size: small; + } + @@ -530,6 +540,7 @@ export const generateMapHTML = function (gameConfig, history) { src="https://gitterra.com/images/background_and_menus/logobanner.svg" /> + v${version}