Skip to content

Commit

Permalink
feat: stargate: Add protodep.toml, protocgen.sh and @cosmjs pac…
Browse files Browse the repository at this point in the history
…kages (#38)
  • Loading branch information
Youngjoon Lee committed Jun 16, 2021
1 parent a307c79 commit c97d62f
Show file tree
Hide file tree
Showing 7 changed files with 430 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ docs/_build

#Logs
npm-debug.log*

third_party/proto/
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"node": ">=10"
},
"scripts": {
"proto-gen": "./protocgen.sh",
"build": "tsc --module commonjs",
"test": "jest",
"lint": "eslint src test --ext .ts,.tsx",
Expand All @@ -34,6 +35,10 @@
},
"homepage": "https://medibloc.org",
"dependencies": {
"@cosmjs/crypto": "^0.25.4",
"@cosmjs/proto-signing": "^0.25.4",
"@cosmjs/stargate": "^0.25.4",
"@cosmjs/tendermint-rpc": "^0.25.4",
"@medibloc/amino-js": "^1.2.0",
"axios": "^0.21.1",
"bech32": "^1.1.4",
Expand Down Expand Up @@ -66,6 +71,7 @@
"eslint": "^7.9.0",
"jest": "^26.4.2",
"ts-jest": "^26.3.0",
"ts-proto": "^1.81.3",
"typescript": "^4.0.2"
}
}
20 changes: 20 additions & 0 deletions protocgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -eo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

SRC_PATH="${SCRIPT_DIR}/third_party/proto"
DST_PATH="${SCRIPT_DIR}/src/proto"

# Fetch 3rd-party proto files
protodep up -u

# Compile only Panacea proto files
mkdir -p ${DST_PATH}
protoc \
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_out="${DST_PATH}" \
--proto_path="${SRC_PATH}" \
--ts_proto_opt="esModuleInterop=true,forceLong=long,useOptional=true" \
$(find "${SRC_PATH}/panacea" -name '*.proto')
22 changes: 22 additions & 0 deletions protodep.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
proto_outdir = "./third_party/proto"

[[dependencies]]
target = "github.com/medibloc/panacea-core/proto"
revision = "8f8223bd73d6d1aabb9eb0a56f1f402ff7c49f47"
branch = "stargate"
path = ""
protocol = ""

[[dependencies]]
target = "github.com/cosmos/cosmos-sdk/third_party/proto"
revision = "842b06003f97d31e4ec83847e9fe8185d51a1fc7"
branch = ""
path = ""
protocol = ""

[[dependencies]]
target = "github.com/cosmos/cosmos-sdk/proto"
revision = "842b06003f97d31e4ec83847e9fe8185d51a1fc7"
branch = ""
path = ""
protocol = ""
15 changes: 15 additions & 0 deletions protodep.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
proto_outdir = "./third_party/proto"

[[dependencies]]
target = "github.com/medibloc/panacea-core/proto"
branch = "stargate" # TODO: use a specific revision

[[dependencies]]
target = "github.com/cosmos/cosmos-sdk/third_party/proto"
revision = "v0.42.5"

[[dependencies]]
target = "github.com/cosmos/cosmos-sdk/proto"
revision = "v0.42.5"


2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
"downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

/* Strict Type-Checking Options */
Expand Down
Loading

0 comments on commit c97d62f

Please sign in to comment.