2022-10-31 16:23:55 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest
|
|
|
|
|
|
|
|
PROJECT_BASE=$(git rev-parse --show-toplevel)
|
|
|
|
|
|
|
|
# change to proto directory
|
|
|
|
cd "${PROJECT_BASE}"/protobufs || exit
|
|
|
|
|
|
|
|
git checkout master
|
|
|
|
|
|
|
|
if git submodule status | grep -q '^[-]|^[+]' ; then \
|
2022-11-02 11:46:54 -07:00
|
|
|
echo "INFO: Re-initializing git submodules..."; \
|
2022-10-31 16:23:55 -07:00
|
|
|
git submodule update --init --recursive; \
|
|
|
|
else \
|
|
|
|
echo "INFO: Updating git submodules..."; \
|
|
|
|
git pull --recurse-submodules; \
|
|
|
|
git submodule update --remote --recursive
|
|
|
|
fi
|
|
|
|
|
|
|
|
# remove old generated protos
|
2022-11-03 17:10:08 -07:00
|
|
|
rm -rf "${PROJECT_BASE}/docs/development/reference/protobuf-api.mdx"
|
2022-10-31 16:23:55 -07:00
|
|
|
|
2022-11-03 17:10:08 -07:00
|
|
|
protoc --doc_opt="${PROJECT_BASE}/protobuf.tmpl,protobuf-api.mdx" --doc_out="${PROJECT_BASE}/docs/development/reference/" --proto_path="${PROJECT_BASE}/protobufs" *.proto
|