-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proto-gen.sh
executable file
·42 lines (35 loc) · 1.31 KB
/
proto-gen.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
#!/usr/bin/env bash
mkdir -p ./generated/services/user
mkdir -p ./generated/services/session
### user
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/user/index.js \
./services/user-service/protos/UserService.proto
yarn pbts \
--out ./generated/services/user/index.d.ts \
./generated/services/user/index.js
### https://github.com/protobufjs/protobuf.js/issues/1222
sed -i -e "s/\[ 'Promise' \]\./Promise/g" "generated/services/user/index.d.ts"
sed -i -e "s/\[ 'object' \]\.<string, any>/{ [k: string]: any }/g" "generated/services/user/index.d.ts"
sed -i -e "s/\[ 'Array' \]\./Array/g" "generated/services/user/index.d.ts"
###
### session
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/session/index.js \
./services/session-service/protos/SessionService.proto
yarn pbts \
--out ./generated/services/session/index.d.ts \
./generated/services/session/index.js
### https://github.com/protobufjs/protobuf.js/issues/1222
sed -i -e "s/\[ 'Promise' \]\./Promise/g" "generated/services/session/index.d.ts"
sed -i -e "s/\[ 'object' \]\.<string, any>/{ [k: string]: any }/g" "generated/services/session/index.d.ts"
sed -i -e "s/\[ 'Array' \]\./Array/g" "generated/services/session/index.d.ts"
###