From bb2cd389615d420eb5d3cb2bf0ad0aea7ddd6982 Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Thu, 15 Dec 2022 17:06:45 +0800 Subject: [PATCH] fix .gitlab-ci.yml --- .gitlab-ci.yml | 17 ++--------------- Makefile | 2 +- config/generate.sh | 29 ++++++++++++++--------------- config/tsconfig.json | 4 ++-- 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e652c4..4c00229 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,8 +9,6 @@ publish_npm: - apk add --update make - apk add --update yarn - apk add --update jq - - apk add --update rsync - - apk add --update protobuf-dev - apk add --update protobuf-dev rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' @@ -19,21 +17,10 @@ publish_npm: script: - npm install -g typescript@4.7.4 - npm install -g ts-proto@1.115.5 - - pwd + - cd ./config - mkdir clients - - make proto - ls - - cd ./config - - rsync -a --prune-empty-dirs ../clients ./ - - | - if [[ ! -f .npmrc ]]; then - echo 'No .npmrc found! Creating one now. Please review the following link for more information: https://docs.gitlab.com/ee/user/packages/npm_registry/index.html#project-level-npm-endpoint-1' - { - echo "@perxis-js:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/" - echo "${CI_API_V4_URL#http*:}/packages/npm/:_authToken=\${CI_JOB_TOKEN}" - echo "${CI_API_V4_URL#http*:}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=\${CI_JOB_TOKEN}" - } >> .npmrc - fi + - make proto - NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version") - yarn pub - echo "Successfully published version ${NPM_PACKAGE_VERSION} to GitLab's NPM registry" diff --git a/Makefile b/Makefile index d1e1bd4..fb5bcd4 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash -o pipefail PROTODIR=perxis-proto/proto -DSTDIR=clients +DSTDIR=config/clients ALLPROTO?=$(shell find $(PROTODIR) -name '*.proto' ) PROTOFILES= $(filter-out proto/status/status.proto, $(ALLPROTO)) diff --git a/config/generate.sh b/config/generate.sh index ddbb86c..bcf7e76 100755 --- a/config/generate.sh +++ b/config/generate.sh @@ -54,30 +54,29 @@ generate_index() { } echo "---deleting existing *.d.ts, *.d.ts.map, *.js, *.js.map files" -find ./clients/*/**/ -path '*.d.ts' -delete -find ./clients/*/**/ -path '*.d.ts.map' -delete -find ./clients/*/**/ -path '*.js' -delete -find ./clients/*/**/ -path '*.js.map' -delete -find ./clients/*/**/ -path '*.ts.bak' -delete -find ./clients -path '*.d.ts' -delete -find ./clients -path '*.d.ts.map' -delete -find ./clients -path '*.js' -delete -find ./clients -path '*.js.map' -delete -find ./clients -path '*.ts.bak' -delete +find ./config/clients/*/**/ -path '*.d.ts' -delete +find ./config/clients/*/**/ -path '*.d.ts.map' -delete +find ./config/clients/*/**/ -path '*.js' -delete +find ./config/clients/*/**/ -path '*.js.map' -delete +find ./config/clients/*/**/ -path '*.ts.bak' -delete +find ./config/clients -path '*.d.ts' -delete +find ./config/clients -path '*.d.ts.map' -delete +find ./config/clients -path '*.js' -delete +find ./config/clients -path '*.js.map' -delete +find ./config/clients -path '*.ts.bak' -delete echo "---generating index.ts files" -ts_files=$(find ./clients/**/ -name '*.ts') +ts_files=$(find ./config/clients/**/ -name '*.ts') ts_files_array=($ts_files) generate_index "${ts_files_array[@]}" echo "---generating *.d.ts, *.d.ts.map, *.js, *.js.map files" npm i protobufjs@6.11.3 -tsc --project ./config --declaration --declarationMap --sourceMap --rootDir ./clients +tsc --project ./config --declaration --declarationMap --sourceMap --rootDir ./config/clients echo "---deleting created tmp files" npm uninstall protobufjs@6.11.3 -find ./clients -name 'index.ts' -delete -find ./clients/*/** -name 'index.ts' -delete -find ./ -maxdepth 1 -name '*.json' -delete +find ./config/clients -name 'index.ts' -delete +find ./config/clients/*/** -name 'index.ts' -delete echo "---process finished" \ No newline at end of file diff --git a/config/tsconfig.json b/config/tsconfig.json index 1728192..84a4bc9 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -98,6 +98,6 @@ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, - "include": ["../../clients/**/*"], - "exclude": ["../../config/**/*"] + "include": ["./clients/**/*"], + "exclude": ["../"] } -- GitLab