From c5b6bc2b4f7cd96fa07dd729bc45c3a606d4a5db Mon Sep 17 00:00:00 2001
From: CaTasTrOOf <benoit@besnard.biz>
Date: Wed, 2 Feb 2022 17:26:29 +0100
Subject: [PATCH] Add gitlab-ci file

---
 .gitignore                             |  4 ----
 .gitlab-ci.yml                         | 23 +++++++++++++++++++++++
 components/navigation/menu/Sidebar.vue |  5 ++++-
 nuxt.config.js                         |  7 +++++++
 package.json                           |  2 +-
 utils/findMissingI18nKeys.sh           |  2 +-
 6 files changed, 36 insertions(+), 7 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitignore b/.gitignore
index 60cde32..3fea6ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -89,7 +89,3 @@ sw.*
 
 # Vim swap files
 *.swp
-
-# Script generated files
-*.missing
-keysUsed
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..b8cdc8b
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,23 @@
+stages:
+  - test
+  - build
+
+check-i18n-job:
+  image: ubuntu:20.04
+  stage: test
+  script:
+    - apt update && apt-get -y install jq
+    - ./utils/findMissingI18nKeys.sh
+  only:
+    - merge_requests
+
+build-job:
+  image: node:16
+  stage: build
+  script:
+    - node --version
+    - npm --version
+    - npm install
+    - npm run build
+  only:
+    - merge_requests
diff --git a/components/navigation/menu/Sidebar.vue b/components/navigation/menu/Sidebar.vue
index 1954e41..15c6043 100644
--- a/components/navigation/menu/Sidebar.vue
+++ b/components/navigation/menu/Sidebar.vue
@@ -5,7 +5,10 @@
 				<img :src="$icon(512)" alt="Accueil" class="logo" />
 				<div>
 					<h1 class="h3">
-						Wotwizard <small><span class="small">v0.22</span></small>
+						Wotwizard
+						<small
+							><span class="small">v{{ $config.clientVersion }}</span></small
+						>
 					</h1>
 					<small class="text-muted">{{ $t("slogan") }}</small>
 				</div>
diff --git a/nuxt.config.js b/nuxt.config.js
index ee308c5..41270b5 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -1,5 +1,6 @@
 import i18n from "./i18n"
 import webpack from "webpack"
+import pkg from "./package.json"
 
 export default {
 	// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
@@ -8,6 +9,12 @@ export default {
 	// Target: https://go.nuxtjs.dev/config-target
 	target: "static",
 
+	// Variables that can be accessed by $config
+	publicRuntimeConfig: {
+		// Application version from package.json
+		clientVersion: pkg.version
+	},
+
 	// Global page headers: https://go.nuxtjs.dev/config-head
 	head: {
 		title: "wotwizard-ui",
diff --git a/package.json b/package.json
index 63e0b61..6412c9f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "wotwizard-ui",
-	"version": "1.0.0",
+	"version": "0.22.0",
 	"private": true,
 	"scripts": {
 		"dev": "nuxt",
diff --git a/utils/findMissingI18nKeys.sh b/utils/findMissingI18nKeys.sh
index 920c4ed..89327de 100755
--- a/utils/findMissingI18nKeys.sh
+++ b/utils/findMissingI18nKeys.sh
@@ -34,7 +34,7 @@ do
         then
             echo -e "create ${RED}$key${NC} in file ${GREEN}$f${NC}"
             value=$(jq -e ".$key" i18n/locales/fr.json)
-            if [ "$value" == "null" ]
+            if [ $value = "null" ]
             then
                 filter=".$key = \"TO_TRANSLATE\""
             else
-- 
GitLab