Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Buf for Protocol Buffers/gRPC code-generation #35

Merged
merged 1 commit into from
Jul 24, 2023
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
28 changes: 13 additions & 15 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ task:
name: JavaScript Protocol Buffers and gRPC code-generation
container:
image: node:latest
env:
OUTDIR: js-codegen
prepare_script:
- apt-get update && apt-get -y install protobuf-compiler
- npm install ts-protoc-gen
code_generation_script:
- mkdir $OUTDIR
- >
protoc
--plugin="protoc-gen-ts=node_modules/.bin/protoc-gen-ts"
--js_out="import_style=commonjs,binary:$OUTDIR"
--ts_out="service=grpc-web:$OUTDIR"
-I proto/
proto/terminal.proto
- find $OUTDIR
js_proto_codegen_artifacts:
path: $OUTDIR/*
- npm install -g @bufbuild/buf ts-protoc-gen
# Work around https://github.com/protocolbuffers/protobuf-javascript/issues/127,
- npm install -g protoc-gen-js
# Work around https://github.com/protocolbuffers/protobuf-javascript/issues/127,
# once Protocol Buffers team manages to properly release protoc-gen-js on NPM,
# it would be as simple as "npm install -g protoc-gen-js"
# (currently it's a third-party package)
work_around_js_split_script:
- wget -O - https://github.com/protocolbuffers/protobuf-javascript/releases/download/v3.21.2/protobuf-javascript-3.21.2-linux-x86_64.tar.gz | tar xz bin/protoc-gen-js
- mv bin/protoc-gen-js /usr/local/bin/
code_generation_script: buf generate
buf_codegen_artifacts:
path: buf-codegen/*

docker_builder:
name: Release Docker Image
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Buf
buf-codegen/
10 changes: 10 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1
plugins:
- name: js
out: buf-codegen
opt:
- import_style=commonjs,binary
- name: ts
out: buf-codegen
opt:
- service=grpc-web
3 changes: 3 additions & 0 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: v1
directories:
- proto
7 changes: 7 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT