diff --git a/scripts/protoc-gen.sh b/scripts/protoc-gen.sh index 3bb554c..f34945e 100755 --- a/scripts/protoc-gen.sh +++ b/scripts/protoc-gen.sh @@ -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 \ @@ -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 diff --git a/src/proto/google/protobuf/duration.ts b/src/proto/google/protobuf/duration.ts index b7fd24e..44f3779 100644 --- a/src/proto/google/protobuf/duration.ts +++ b/src/proto/google/protobuf/duration.ts @@ -1,7 +1,4 @@ // Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.12.4 -// protoc v7.36.2 // source: google/protobuf/duration.proto /* eslint-disable */ diff --git a/src/proto/google/protobuf/struct.ts b/src/proto/google/protobuf/struct.ts index 64a5733..1d19635 100644 --- a/src/proto/google/protobuf/struct.ts +++ b/src/proto/google/protobuf/struct.ts @@ -1,7 +1,4 @@ // Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.12.4 -// protoc v7.36.2 // source: google/protobuf/struct.proto /* eslint-disable */ diff --git a/src/proto/run_function.ts b/src/proto/run_function.ts index 7d517b5..7a52474 100644 --- a/src/proto/run_function.ts +++ b/src/proto/run_function.ts @@ -1,7 +1,4 @@ // Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v2.12.4 -// protoc v7.36.2 // source: run_function.proto /* eslint-disable */