25 lines
726 B
Bash
Executable File
25 lines
726 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Generate TypeScript gRPC stubs from the vendored proto into ts/src/genpb,
|
|
# using ts-proto with @grpc/grpc-js service output.
|
|
set -euo pipefail
|
|
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$here/ts"
|
|
|
|
plugin="node_modules/.bin/protoc-gen-ts_proto"
|
|
if [[ ! -x "$plugin" ]]; then
|
|
echo "ts-proto not installed; run 'npm install' in ts/ first" >&2
|
|
exit 1
|
|
fi
|
|
|
|
out="src/genpb"
|
|
rm -rf "$out"; mkdir -p "$out"
|
|
|
|
protoc -I ../proto \
|
|
--plugin=protoc-gen-ts_proto="$plugin" \
|
|
--ts_proto_out="$out" \
|
|
--ts_proto_opt=outputServices=grpc-js,esModuleInterop=true,env=node,useExactTypes=false,unrecognizedEnum=false \
|
|
st-peter-auth.proto
|
|
|
|
echo "Generated TypeScript stubs under ts/src/genpb/"
|