Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions scripts/protoc-gen.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

set -x
set -euo pipefail
set -x

rm -rf ./src/proto/*.js ./src/proto/*.ts
rm -rf ./src/proto/*.js ./src/proto/*.ts

protoc \
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
Expand All @@ -11,3 +12,21 @@ protoc \
--proto_path=./src/proto \
./src/proto/run_function.proto

# Strip the generator version stamp from the header of every generated file.
#
# ts-proto records its own version and protoc's in a "// versions:" block. That
# makes the output change on every dependency bump even when the generated code
# is identical, so the CI drift check fails on routine renovate PRs and someone
# has to regenerate and commit three lines of comment to make it green.
#
# Dropping the block makes the output depend only on the .proto input and the
# generator flags, which is what the check is meant to police. The versions
# themselves stay recorded in package.json and the workflow's protoc pin.
find ./src/proto -name '*.ts' -print0 | while IFS= read -r -d '' f; do
sed -i.bak \
-e '/^\/\/ versions:$/d' \
-e '/^\/\/ protoc-gen-ts_proto /d' \
-e '/^\/\/ protoc /d' \
"$f"
rm -f "$f.bak"
done
3 changes: 0 additions & 3 deletions src/proto/google/protobuf/duration.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/proto/google/protobuf/struct.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/proto/run_function.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading