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

feat: add ts-protoc-gen plugin #113

Merged
merged 2 commits into from
Nov 27, 2022
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
1 change: 1 addition & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
GRPC_RUST_VERSION=${{ env.GRPC_RUST_VERSION }}
GRPC_SWIFT_VERSION=${{ env.GRPC_SWIFT_VERSION }}
GRPC_WEB_VERSION=${{ env.GRPC_WEB_VERSION }}
NODE_VERSION=${{ env.NODE_VERSION }}
PROTOC_GEN_DART_VERSION=${{ env.PROTOC_GEN_DART_VERSION }}
PROTOC_GEN_DOC_VERSION=${{ env.PROTOC_GEN_DOC_VERSION }}
PROTOC_GEN_GO_GRPC_VERSION=${{ env.PROTOC_GEN_GO_GRPC_VERSION }}
Expand Down
18 changes: 17 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# syntax=docker/dockerfile:1.4

ARG ALPINE_VERSION
ARG GO_VERSION
ARG NODE_VERSION
ARG RUST_VERSION
ARG SWIFT_VERSION

Expand Down Expand Up @@ -293,8 +296,19 @@ ARG TARGETPLATFORM
RUN xx-verify /out/usr/bin/protoc-gen-lint


FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} as protoc_gen_ts
ARG PROTOC_GEN_TS_VERSION
RUN npm install -g pkg ts-protoc-gen@${PROTOC_GEN_TS_VERSION}
RUN pkg \
--compress Brotli \
--targets node${NODE_VERSION}-alpine \
-o protoc-gen-ts \
/usr/local/lib/node_modules/ts-protoc-gen
RUN install -D protoc-gen-ts /out/usr/bin/protoc-gen-ts


FROM --platform=$BUILDPLATFORM alpine_host as upx
RUN mkdir -p /upx
RUN mkdir -p /upx
ARG BUILDARCH BUILDOS UPX_VERSION
RUN if ! [ "${TARGETARCH}" = "arm64" ]; then curl -sSL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-${BUILDARCH}_${BUILDOS}.tar.xz | tar xJ --strip 1 -C /upx; fi
RUN if ! [ "${TARGETARCH}" = "arm64" ]; then install -D /upx/upx /usr/local/bin/upx; fi
Expand Down Expand Up @@ -329,6 +343,7 @@ RUN find /out -name "*.a" -delete -or -name "*.la" -delete
FROM alpine:${ALPINE_VERSION}
LABEL maintainer="Roman Volosatovs <[email protected]>"
COPY --from=upx /out/ /
COPY --from=protoc_gen_ts /out/ /
strophy marked this conversation as resolved.
Show resolved Hide resolved
RUN apk add --no-cache \
bash\
grpc \
Expand Down Expand Up @@ -376,6 +391,7 @@ RUN protoc-wrapper \
--python_out=/test \
--ruby_out=/test \
--rust_out=/test \
--ts_out=/test \
--validate_out=lang=go:/test \
google/protobuf/any.proto
RUN protoc-wrapper \
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ It started out as https://github.com/znly/docker-protobuf fork, but grew into a
- [grpc/grpc-java](https://github.com/grpc/grpc-java) (not on `arm64`)
- [grpc/grpc-swift](https://github.com/grpc/grpc-swift) (not on `arm64`, see https://github.com/rvolosatovs/docker-protobuf/issues/77 for potential issues)
- [grpc/grpc-web](https://github.com/grpc/grpc-web)
- [improbable-eng/ts-protoc-gen](https://github.com/improbable-eng/ts-protoc-gen)
- [protobuf-c/protobuf-c](https://github.com/protobuf-c/protobuf-c)
- [pseudomuto/protoc-gen-doc](https://github.com/pseudomuto/protoc-gen-doc)
- [stepancheg/grpc-rust](https://github.com/stepancheg/grpc-rust)
Expand All @@ -40,6 +41,7 @@ It started out as https://github.com/znly/docker-protobuf fork, but grew into a
- Ruby
- Rust
- Swift
- Typescript

## Usage
```
Expand Down
1 change: 1 addition & 0 deletions check-versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func main() {
{"stepancheg", "rust-protobuf"},
{"rust-lang", "rust"},
{"apple", "swift"},
{"improbable-eng", "ts-protoc-gen"},
{"upx", "upx"},
} {
tag := "n/a"
Expand Down
2 changes: 2 additions & 0 deletions deps.list
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GRPC_GATEWAY_VERSION=2.14.0
GRPC_RUST_VERSION=0.8.3
GRPC_SWIFT_VERSION=1.13.0
strophy marked this conversation as resolved.
Show resolved Hide resolved
GRPC_WEB_VERSION=1.4.2
NODE_VERSION=18.5.0
PROTOC_GEN_DOC_VERSION=1.5.1
PROTOC_GEN_GO_GRPC_VERSION=1.51.0
PROTOC_GEN_GO_VERSION=1.28.1
Expand All @@ -15,6 +16,7 @@ PROTOC_GEN_GQL_VERSION=0.8.0
PROTOC_GEN_JSONSCHEMA_VERSION=1.3.10
PROTOC_GEN_LINT_VERSION=0.3.0
PROTOC_GEN_RUST_VERSION=3.2.0
PROTOC_GEN_TS_VERSION=0.15.0
PROTOC_GEN_VALIDATE_VERSION=0.9.0
RUST_VERSION=1.65.0
SWIFT_VERSION=5.7-focal
Expand Down