Skip to content

Commit 73e1abb

Browse files
committed
chore: add protoc-gen-js
1 parent a63377c commit 73e1abb

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

.github/renovate.json

+6
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@
121121
"depNameTemplate": "danielvladco/go-proto-gql",
122122
"datasourceTemplate": "github-releases"
123123
},
124+
{
125+
"fileMatch": ["^deps\\.list$"],
126+
"matchStrings": ["PROTOC_GEN_JS_VERSION=(?<currentValue>.*?)\\n"],
127+
"depNameTemplate": "protocolbuffers/protobuf-javascript",
128+
"datasourceTemplate": "github-releases"
129+
},
124130
{
125131
"fileMatch": ["^deps\\.list$"],
126132
"matchStrings": ["PROTOC_GEN_JSONSCHEMA_VERSION=(?<currentValue>.*?)\\n"],

Dockerfile

+37
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,42 @@ ARG TARGETPLATFORM
315315
RUN xx-verify /out/usr/bin/protoc-gen-lint
316316

317317

318+
FROM alpine:${ALPINE_IMAGE_VERSION} as protoc_gen_js
319+
COPY --from=xx / /
320+
RUN mkdir -p /out
321+
RUN apk add --no-cache \
322+
bash \
323+
build-base \
324+
curl \
325+
linux-headers \
326+
openjdk11-jdk \
327+
python3 \
328+
unzip \
329+
zip
330+
331+
# Build Bazel
332+
# TODO: Remove when Bazel 5.2.0+ is available in Alpine
333+
# https://github.com/bazelbuild/bazel/pull/14391
334+
ARG BAZEL_VERSION=6.0.0
335+
RUN mkdir -p /tmp/bazel-release
336+
WORKDIR /tmp/bazel-release
337+
RUN curl -sSLO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip && unzip -q bazel-${BAZEL_VERSION}-dist.zip
338+
RUN env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh
339+
RUN install -D output/bazel /usr/local/bin/bazel
340+
341+
# Build protoc-gen-js
342+
# TODO: Remove when protoc-gen-js is available in Alpine
343+
# https://gitlab.alpinelinux.org/alpine/aports/-/issues/14399
344+
RUN mkdir -p /protoc_gen_js
345+
ARG PROTOC_GEN_JS_VERSION
346+
RUN curl -sSL https://api.github.com/repos/protocolbuffers/protobuf-javascript/tarball/${PROTOC_GEN_JS_VERSION} | tar xz --strip 1 -C /protoc_gen_js
347+
WORKDIR /protoc_gen_js
348+
RUN bazel build plugin_files
349+
RUN install -D /protoc_gen_js/bazel-bin/generator/protoc-gen-js /out/usr/bin/protoc-gen-js
350+
ARG TARGETPLATFORM
351+
RUN xx-verify /out/usr/bin/protoc-gen-js
352+
353+
318354
FROM node:${NODE_IMAGE_VERSION} as protoc_gen_ts
319355
ARG NODE_IMAGE_VERSION
320356
ARG PROTOC_GEN_TS_VERSION
@@ -368,6 +404,7 @@ COPY --from=protoc_gen_gorm /out/ /out/
368404
COPY --from=protoc_gen_gotemplate /out/ /out/
369405
COPY --from=protoc_gen_govalidators /out/ /out/
370406
COPY --from=protoc_gen_gql /out/ /out/
407+
COPY --from=protoc_gen_js /out/ /out/
371408
COPY --from=protoc_gen_jsonschema /out/ /out/
372409
COPY --from=protoc_gen_lint /out/ /out/
373410
COPY --from=protoc_gen_rust /out/ /out/

deps.list

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ PROTOC_GEN_GORM_VERSION=v1.1.2
1616
PROTOC_GEN_GOTEMPLATE_VERSION=v1.11.3
1717
PROTOC_GEN_GOVALIDATORS_VERSION=v0.3.2
1818
PROTOC_GEN_GQL_VERSION=v0.8.0
19+
PROTOC_GEN_JS_VERSION=v3.21.2
1920
PROTOC_GEN_JSONSCHEMA_VERSION=1.3.10
2021
PROTOC_GEN_LINT_VERSION=v0.3.0
2122
PROTOC_GEN_RUST_VERSION=v3.2.0

0 commit comments

Comments
 (0)