-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-proto.sh
49 lines (42 loc) · 1.13 KB
/
gen-proto.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
rm -r proto
rm -r proto-thirdparty
wget https://github.com/bufbuild/buf/releases/download/v1.13.1/buf-Linux-x86_64
sudo chmod 777 ./buf-Linux-x86_64
./buf-Linux-x86_64 export buf.build/cosmos/cosmos-sdk:8cb30a2c4de74dc9bd8d260b1e75e176 --output ./chain/proto-thirdparty
rm ./buf-Linux-x86_64
cp -r ./chain/proto ./
cp -r ./chain/proto-thirdparty ./
mv ./proto-thirdparty/tendermint ./proto/
proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
proto_files=()
for dir in $proto_dirs; do
proto_files=("${proto_files[@]} $(find "${dir}" -maxdepth 1 -name '*.proto')")
done
npx pbjs \
-o ./src/proto.cjs \
-t static-module \
--force-long \
--keep-case \
--no-create \
--path=./proto/ \
--path=./proto-thirdparty/ \
--root=osmosis-client \
${proto_files[@]}
npx pbjs \
-o ./src/proto.js \
-t static-module \
-w es6 \
--es6 \
--force-long \
--keep-case \
--no-create \
--path=./proto/ \
--path=./proto-thirdparty/ \
--root=osmosis-client \
${proto_files[@]}
npx pbts \
-o ./src/proto.d.ts \
./src/proto.js
rm -r proto
rm -r proto-thirdparty