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

---
 .gitlab-ci.yml     |  6 +++---
 Makefile           | 14 +++++++-------
 config/generate.sh |  2 --
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 03f8de1..09b1efa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,16 +7,16 @@ publish_npm:
   before_script:
     - apk add --update bash
     - apk add --update make
-    - apk add --update yarn
-    - apk add --update jq
     - apk add --update protobuf-dev
+    - apk add --update yarn
+
   rules:
     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
       changes:
         - config/package.json
   script:
+    - npm install ts-proto@1.115.5
     - npm install -g typescript@4.7.4
-    - npm install -g ts-proto@1.115.5
     - make proto
     - cd ./config
     - NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version")
diff --git a/Makefile b/Makefile
index d4c3860..0295bbc 100644
--- a/Makefile
+++ b/Makefile
@@ -22,13 +22,13 @@ proto-js: protoc-check js-check $(PROTOTSFILES) generate-ts generate-js
 
 %.ts: %.proto
 	@protoc -I=$(PROTODIR) \
-	--plugin=@protoc-gen-ts_proto \
+	--plugin=./node_modules/.bin/protoc-gen-ts_proto \
  	--ts_proto_opt=env=browser,outputServices=generic-definitions,outputJsonMethods=false,esModuleInterop=true,useOptionals=messages,exportCommonSymbols=false,useDate=false,useExactTypes=false \
  	--ts_proto_out=$(DSTDIR) \
  	"$<"
 
 generate-ts:
-	@echo "Generated all protobuf TypeScript files"
+	@echo "Generated all TypeScript files"
 
 generate-js:
 	@./config/generate.sh
@@ -55,11 +55,11 @@ 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 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\" \
diff --git a/config/generate.sh b/config/generate.sh
index 7e9c7a7..59ef7a6 100755
--- a/config/generate.sh
+++ b/config/generate.sh
@@ -54,7 +54,6 @@ generate_index() {
 }
 
 echo "---deleting existing *.d.ts, *.d.ts.map, *.js, *.js.map files"
-pwd
 find ./config/dist/*/**/ -path '*.d.ts' -delete
 find ./config/dist/*/**/ -path '*.d.ts.map' -delete
 find ./config/dist/*/**/ -path '*.js' -delete
@@ -67,7 +66,6 @@ find ./config/dist -path '*.js.map' -delete
 find ./config/dist -path '*.ts.bak' -delete
 
 echo "---generating index.ts files"
-pwd
 ts_files=$(find ./config/dist/**/ -name '*.ts')
 ts_files_array=($ts_files)
 generate_index "${ts_files_array[@]}"
-- 
GitLab