-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproto-gen.sh
executable file
·147 lines (123 loc) · 4.88 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env bash
mkdir -p ./generated/services
mkdir -p ./generated/services/course
mkdir -p ./generated/services/timetable
mkdir -p ./generated/services/schoolCalendar
mkdir -p ./generated/services/donation
mkdir -p ./generated/services/information
mkdir -p ./generated/services/session
mkdir -p ./generated/services/user
### course
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/course/index.js \
./services/course-service/protos/CourseService.proto
yarn pbts \
--out ./generated/services/course/index.d.ts \
./generated/services/course/index.js
### https://github.com/protobufjs/protobuf.js/issues/1222
sed -i -e "s/\[ 'Promise' \]\./Promise/g" "generated/services/course/index.d.ts"
sed -i -e "s/\[ 'object' \]\.<string, any>/{ [k: string]: any }/g" "generated/services/course/index.d.ts"
sed -i -e "s/\[ 'Array' \]\./Array/g" "generated/services/course/index.d.ts"
###
### timetable
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/timetable/index.js \
./services/timetable-service/protos/Nullable.proto \
./services/timetable-service/protos/Message.proto \
./services/timetable-service/protos/TimetableService.proto
yarn pbts \
--out ./generated/services/timetable/index.d.ts \
./generated/services/timetable/index.js
### https://github.com/protobufjs/protobuf.js/issues/1222
sed -i -e "s/\[ 'Promise' \]\./Promise/g" "generated/services/timetable/index.d.ts"
sed -i -e "s/\[ 'object' \]\.<string, any>/{ [k: string]: any }/g" "generated/services/timetable/index.d.ts"
sed -i -e "s/\[ 'Array' \]\./Array/g" "generated/services/timetable/index.d.ts"
###
### schoolCalendar
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/schoolCalendar/index.js \
./services/school-calendar-service/protos/SchoolCalendarService.proto
yarn pbts \
--out ./generated/services/schoolCalendar/index.d.ts \
./generated/services/schoolCalendar/index.js
### https://github.com/protobufjs/protobuf.js/issues/1222
sed -i -e "s/\[ 'Promise' \]\./Promise/g" "generated/services/schoolCalendar/index.d.ts"
sed -i -e "s/\[ 'object' \]\.<string, any>/{ [k: string]: any }/g" "generated/services/schoolCalendar/index.d.ts"
sed -i -e "s/\[ 'Array' \]\./Array/g" "generated/services/schoolCalendar/index.d.ts"
###
### donation
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/donation/index.js \
./services/donation-service/protos/DonationService.proto
yarn pbts \
--out ./generated/services/donation/index.d.ts \
./generated/services/donation/index.js
### https://github.com/protobufjs/protobuf.js/issues/1222
sed -i -e "s/\[ 'Promise' \]\./Promise/g" "generated/services/donation/index.d.ts"
sed -i -e "s/\[ 'object' \]\.<string, any>/{ [k: string]: any }/g" "generated/services/donation/index.d.ts"
sed -i -e "s/\[ 'Array' \]\./Array/g" "generated/services/donation/index.d.ts"
###
### information
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/information/index.js \
./services/information-service/protos/InformationService.proto
yarn pbts \
--out ./generated/services/information/index.d.ts \
./generated/services/information/index.js
### https://github.com/protobufjs/protobuf.js/issues/1222
sed -i -e "s/\[ 'Promise' \]\./Promise/g" "generated/services/information/index.d.ts"
sed -i -e "s/\[ 'object' \]\.<string, any>/{ [k: string]: any }/g" "generated/services/information/index.d.ts"
sed -i -e "s/\[ 'Array' \]\./Array/g" "generated/services/information/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"
###
### user
yarn pbjs \
--target static-module \
--no-encode \
--no-decode \
--path ../../ \
--out generated/services/user/index.js \
./services/user-service/server/pb/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"
###