vitess.io/vitess@v0.16.2/web/vtadmin/bin/generate-proto-types.sh (about) 1 #!/bin/bash 2 3 # Copyright 2020 The Vitess Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # This script generates JavaScript/TypeScript bindings from 18 # the Vitess .proto files. 19 20 set -e 21 22 vtadmin_root="$VTROOT/web/vtadmin" 23 vitess_proto_root="$VTROOT/proto" 24 25 pbjs_bin="$vtadmin_root/node_modules/.bin/pbjs" 26 pbts_bin="$vtadmin_root/node_modules/.bin/pbts" 27 28 proto_targets="vtadmin.proto" 29 output_filename="vtadmin" 30 output_dir="$vtadmin_root/src/proto" 31 32 mkdir -p "$output_dir" 33 34 $pbjs_bin \ 35 --keep-case \ 36 -p "$vitess_proto_root" \ 37 -t static-module \ 38 -w commonjs \ 39 -o "$output_dir/$output_filename.js" \ 40 "$proto_targets" 41 42 $pbts_bin \ 43 -o "$output_dir/$output_filename.d.ts" \ 44 "$output_dir/$output_filename.js"