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

Adding support to Typescript #27

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ARG GRPC_GATEWAY_VERSION=1.16.0
ARG GRPC_JAVA_VERSION=1.35.0
ARG GRPC_CSHARP_VERSION=1.35.0
ARG GRPC_VERSION=1.35.0
ARG GRPC_WEB_VERSION=1.3.1
ARG PROTOC_GEN_GO_VERSION=1.31.0
# v1.3.2, using the version directly does not work: "tar: invalid magic"
ARG PROTOC_GEN_GOGO_VERSION=b03c65ea87cdc3521ede29f62fe3ce239267c1bc
Expand Down Expand Up @@ -49,6 +50,10 @@ RUN mkdir -p /grpc-java && \
rm -Rf /grpc-java && \
rm -Rf /grpc

ARG GRPC_WEB_VERSION
RUN curl -sSLO https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_VERSION}/protoc-gen-grpc-web-${GRPC_WEB_VERSION}-linux-x86_64 && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rubens21 we are using a multi-arch build (for amd64 and arm64). I see that at least in v1.5.0 of GPRC_WEB they publish aarch64 build, so if you want to change this to work with both, we could merge.

I would've preferred to have some test. Right now we test the build by running make proto in jaeger-idl, which I think exercises multiple languages. We could include the new TS output there.

mv protoc-gen-grpc-web-${GRPC_WEB_VERSION}-linux-x86_64 /out/usr/bin/protoc-gen-grpc-web && \
chmod +x /out/usr/bin/protoc-gen-grpc-web

FROM protoc_base AS protoc_cs_builder
ARG GRPC_CSHARP_VERSION
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ A lightweight `protoc` Docker image, published as `jaegertracing/protobuf` to [D
- https://github.com/grpc-ecosystem/grpc-gateway
- https://github.com/grpc/grpc
- https://github.com/grpc/grpc-java
- https://github.com/grpc/grpc-web

## Supported languages
- C#
- C++
- Go
- Java / JavaNano (Android)
- JavaScript
- JavaScript (pure)
- TypeScript (gRPC Web)
- Objective-C
- PHP
- Python
Expand Down Expand Up @@ -56,6 +58,7 @@ $ docker run --rm jaegertracing/protobuf --help
--php_out=OUT_DIR Generate PHP source file.
--python_out=OUT_DIR Generate Python source file.
--ruby_out=OUT_DIR Generate Ruby source file.
--js_out=OUT_DIR --grpc-web_out=import_style=typescript,mode=grpcweb:OUT_DIR Generate Typescript source file.
```

Example for Java:
Expand All @@ -64,6 +67,11 @@ docker run --rm -u $(id -u) -v${PWD}:${PWD} -w${PWD} jaegertracing/protobuf:late
--java_out=${PWD} -I/usr/include/github.com/gogo/protobuf ${PWD}/model.proto
```

Note about Typescript:
This is currently an experimental feature.
**Do not** use `import_style=typescript` for `--js_out` ([read plugin documentation](https://github.com/grpc/grpc-web#typescript-support))


CLI options:
- `--proto_path`: The path where protoc should search for proto files
- `--java_out` : Generate Java code in the provided path
Expand Down