Skip to content

Commit

Permalink
build: codegen to call clean on a per pkg basis
Browse files Browse the repository at this point in the history
    Primary Changes
    ---------------
    1. Updated codegen scripts of all affected packages to include a global
       openapi-generator-ignore file
    2. Created script to clean openapi folders generated by codegen for
       typescript-axios and kotlin

    Secondary Changes
    -----------------
    1. Removed duplicated code generated previously when codegen clear wasn't
       enabled
    2. Created openapi-generator-ignore file at project root for global ignore
       rules

Signed-off-by: jagpreetsinghsasan <[email protected]>
  • Loading branch information
jagpreetsinghsasan committed Oct 17, 2023
1 parent 9e66850 commit 3f2e9b1
Show file tree
Hide file tree
Showing 208 changed files with 94 additions and 3,773 deletions.
5 changes: 5 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages/**/src/main/typescript/generated/openapi/typescript-axios/docs/git_push.sh
packages/**/src/main/typescript/generated/openapi/typescript-axios/docs/.npmignore
packages/**/src/main/typescript/generated/openapi/typescript-axios/docs/.gitignore
packages/**/src/main/kotlin/generated/openapi/kotlin-client/docs/**
packages/**/src/main/kotlin/generated/openapi/kotlin-client/gradle/**
5 changes: 5 additions & 0 deletions openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages/**/src/main/typescript/generated/openapi/typescript-axios/git_push.sh
packages/**/src/main/typescript/generated/openapi/typescript-axios/.npmignore
packages/**/src/main/typescript/generated/openapi/typescript-axios/.gitignore
packages/**/src/main/kotlin/generated/openapi/kotlin-client/docs/**
packages/**/src/main/kotlin/generated/openapi/kotlin-client/gradle/**
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"codegen": "run-s 'codegen:warmup-*' codegen:lerna codegen:cleanup",
"codegen:cleanup": "rm --force --verbose ./openapitools.json",
"codegen:lerna": "lerna run codegen",
"codegen:warmup-cleancodegendir": "node tools/clear-openapi-codegen-folders.js",
"codegen:warmup-mkdir": "make-dir ./node_modules/@openapitools/openapi-generator-cli/versions/",
"codegen:warmup-v6.6.0": "nwget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.6.0/openapi-generator-cli-6.6.0.jar -O ./node_modules/@openapitools/openapi-generator-cli/versions/6.6.0.jar",
"watch-other": "lerna run --parallel watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/cactus-cmd-api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"codegen:openapi": "npm run generate-sdk",
"codegen:proto": "run-s proto:openapi proto:protoc-gen-ts",
"generate-sdk": "run-p 'generate-sdk:*'",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios --reserved-words-mappings protected=protected",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"proto:openapi": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g protobuf-schema --model-name-suffix=PB --additional-properties=packageName=org.hyperledger.cactus.cmd_api_server -o ./src/main/proto/generated/openapi/ -t=./src/main/openapi-generator/templates/protobuf-schema/",
"proto:protoc-gen-ts": "yarn run grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ ./src/main/proto/generated/openapi/services/*.proto",
"watch": "npm-watch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

docs/**
gradle/**
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.openapi-generator-ignore
README.md
build.gradle
gradlew
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

git_push.sh
.npmignore
.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.openapi-generator-ignore
api.ts
base.ts
common.ts
Expand Down
4 changes: 2 additions & 2 deletions packages/cactus-core-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"codegen:openapi": "npm run generate-sdk",
"codegen:proto": "run-s proto:protoc-gen-ts",
"generate-sdk": "run-s 'generate-sdk:*'",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"proto:protoc-gen-ts": "run-s proto:protoc-gen-ts:make-dir proto:protoc-gen-ts:grpc_tools_node_protoc",
"proto:protoc-gen-ts:make-dir": "make-dir ./src/main/typescript/generated/proto/protoc-gen-ts/weaver/common/protos/",
"proto:protoc-gen-ts:grpc_tools_node_protoc": "yarn run grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/weaver/common/protos/ --proto_path ./src/main/proto/weaver/common/protos/ ./src/main/proto/weaver/common/protos/common/*.proto ./src/main/proto/weaver/common/protos/corda/*.proto ./src/main/proto/weaver/common/protos/driver/*.proto ./src/main/proto/weaver/common/protos/networks/*.proto ./src/main/proto/weaver/common/protos/relay/*.proto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

docs/**
gradle/**
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.openapi-generator-ignore
README.md
build.gradle
gradlew
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

git_push.sh
.npmignore
.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.openapi-generator-ignore
api.ts
base.ts
common.ts
Expand Down
4 changes: 2 additions & 2 deletions packages/cactus-plugin-consortium-manual/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"codegen": "run-p 'codegen:*'",
"codegen:openapi": "npm run generate-sdk",
"generate-sdk": "run-p 'generate-sdk:*'",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

docs/**
gradle/**
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.openapi-generator-ignore
README.md
build.gradle
gradlew
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

git_push.sh
.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.gitignore
.openapi-generator-ignore
api.ts
base.ts
common.ts
Expand Down
4 changes: 2 additions & 2 deletions packages/cactus-plugin-htlc-eth-besu-erc20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"codegen": "run-p 'codegen:*'",
"codegen:openapi": "npm run generate-sdk",
"generate-sdk": "run-p 'generate-sdk:*'",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected",
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev",
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

docs/**
gradle/**
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.openapi-generator-ignore
README.md
build.gradle
gradlew
Expand Down
Loading

0 comments on commit 3f2e9b1

Please sign in to comment.