From 25b9c90ccca0c33ff335a2aee37be9a6bdcaf996 Mon Sep 17 00:00:00 2001
From: ko_oler <kooler89@gmail.com>
Date: Thu, 15 Dec 2022 16:26:31 +0800
Subject: [PATCH] fix .gitlab-ci.yml

---
 .gitlab-ci.yml |  9 +++++----
 Makefile       | 38 +++++++++++++++++++-------------------
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 710bef8..46eecc8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,9 +17,11 @@ publish_npm:
       changes:
         - config/package.json
   script:
+    - npm install -g typescript@4.7.4
+    - npm install -g ts-proto@1.115.5
     - mkdir clients
-    - npm install ts-proto@1.115.5
     - make proto
+    - ls
     - cd ./config
     - rsync -a --prune-empty-dirs ../clients ./
     - |
@@ -31,10 +33,9 @@ publish_npm:
           echo "${CI_API_V4_URL#http*:}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=\${CI_JOB_TOKEN}"
         } >> .npmrc
       fi
-    - NPM_PACKAGE_CURRENT_VERSION=$(npm show ${NPM_PACKAGE_NAME} version)
-    - echo -E "$(jq --arg version $NPM_PACKAGE_CURRENT_VERSION '.version = $version' package.json)" > package.json
+    - NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version")
     - yarn pub
-    - echo "Successfully published version ${NPM_PACKAGE_CURRENT_VERSION} of ${NPM_PACKAGE_NAME} to GitLab's NPM registry"
+    - echo "Successfully published version ${NPM_PACKAGE_VERSION} to GitLab's NPM registry"
     - rm -rf ./clients
     - cd ..
     - rm -rf ./clients
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 5de7249..d1e1bd4 100644
--- a/Makefile
+++ b/Makefile
@@ -53,22 +53,22 @@ ifeq (,$(shell which npm))
 	$(error "NPM not found. Run for linux: \"sudo apt install npm\", for mac: \"brew install npm\" \
 	or visit \"https://docs.npmjs.com/getting-started\" for more.\n")
 endif
-#ifeq (,$(shell which protoc-gen-ts_proto))
-#	$(error "Ts-proto plugin for protoc not found. \
-#	Run \"npm install -g ts-proto@1.115.5\" \
-#	or visit \"https://github.com/stephenh/ts-proto\" for more.\n")
-#endif
-#ifeq (,$(shell which tsc))
-#	$(error "Typescript not found. \
-#	Run \"npm install -g typescript@4.7.4\" \
-#	or visit \"https://github.com/microsoft/TypeScript\" for more.\n")
-#endif
-#ifneq ($(shell expr $(TSC_MAJOR_VERSION) \>= 4), 1)
-#  	 $(error "Current version is outdated. Please update typescript \n")
-#endif
-#ifneq ($(shell expr $(TSC_MINOR_VERSION) \>= 7), 1)
-#  	 $(error "Current version is lower than 4.7 Please update typescript \n")
-#endif
-#ifneq ($(shell expr $(TSC_MIC_VERSION) \>= 4), 1)
-#  	 $(error "Current version is lower than 4.7.4 Please update typescript \n")
-#endif
\ No newline at end of file
+ifeq (,$(shell which protoc-gen-ts_proto))
+	$(error "Ts-proto plugin for protoc not found. \
+	Run \"npm install -g ts-proto@1.115.5\" \
+	or visit \"https://github.com/stephenh/ts-proto\" for more.\n")
+endif
+ifeq (,$(shell which tsc))
+	$(error "Typescript not found. \
+	Run \"npm install -g typescript@4.7.4\" \
+	or visit \"https://github.com/microsoft/TypeScript\" for more.\n")
+endif
+ifneq ($(shell expr $(TSC_MAJOR_VERSION) \>= 4), 1)
+  	 $(error "Current version is outdated. Please update typescript \n")
+endif
+ifneq ($(shell expr $(TSC_MINOR_VERSION) \>= 7), 1)
+  	 $(error "Current version is lower than 4.7 Please update typescript \n")
+endif
+ifneq ($(shell expr $(TSC_MIC_VERSION) \>= 4), 1)
+  	 $(error "Current version is lower than 4.7.4 Please update typescript \n")
+endif
\ No newline at end of file
-- 
GitLab