Missing TypeScript type definitions
Opened this issue · 2 comments
muvaf commented
Getting the following when used in a TypeScript project:
Try `npm i --save-dev @types/android-emulator-webrtc` if it exists or add a new declaration (.d.ts) file containing `declare module 'android-emulator-webrtc/emulator';`
I see that there is a function called PrintTypescriptFile
here but looks like its result is not included in the npm package.
muvaf commented
I built with make
succesfully in Ubuntu 22.04 and then changed the import_style
parameter in Makefile
to trigger running of PrintTypescriptFile
. But I'm getting the following error:
protoc \
-I/usr/local/include -I/android-emulator-webrtc/src/proto/ -I/android-emulator-webrtc/proto \
--plugin=protoc-gen-grpc-web=/android-emulator-webrtc/protoc-gen-grpc-web \
--js_out=import_style=typescript,binary:/android-emulator-webrtc/src/proto/ \
--grpc-web_out=import_style=typescript,mode=grpcwebtext:/android-emulator-webrtc/src/proto/ \
/android-emulator-webrtc/proto/emulator_controller.proto
python eslint_prefix.py /android-emulator-webrtc/src/proto//emulator_controller_pb.js
Traceback (most recent call last):
File "/android-emulator-webrtc/eslint_prefix.py", line 37, in <module>
main(sys.argv)
File "/android-emulator-webrtc/eslint_prefix.py", line 28, in main
with open(fname, 'r') as fn:
FileNotFoundError: [Errno 2] No such file or directory: '/android-emulator-webrtc/src/proto//emulator_controller_pb.js'
make: *** [Makefile:76: /android-emulator-webrtc/src/proto//emulator_controller_pb.js] Error 1
This is inside a ubuntu:22.04
container where I installed libprotoc-dev protobuf-compiler curl pkg-config g++ python3
and NodeJS.
muvaf commented
Just for future reference, the following edited version of cloudbuilders/Dockerfile
successfully generates the type bindings on macOS arm64 where /repo
is mounted to this repo:
FROM debian:buster-slim
ARG VERS=23.1
ARG ARCH=linux-aarch_64
ARG ARCH_GRPC_WEB=linux-aarch64
ARG GRPC_WEB=1.4.2
ARG JS=3.21.2
RUN echo "Building protoc Cloud Builder ${VERS}-${ARCH}" && \
apt-get update && \
apt-get install wget unzip make g++ -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN wget "https://github.com/protocolbuffers/protobuf/releases/download/v${VERS}/protoc-${VERS}-${ARCH}.zip" && \
unzip "protoc-${VERS}-${ARCH}.zip" -d protoc && rm "protoc-${VERS}-${ARCH}.zip" && \
wget "https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB}/protoc-gen-grpc-web-${GRPC_WEB}-${ARCH_GRPC_WEB}" -O /protoc/bin/protoc-gen-grpc-web && \
chmod a+x /protoc/bin/protoc-gen-grpc-web && \
wget "https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${JS}/protobuf-javascript-${JS}-${ARCH}.zip" && \
unzip "protobuf-javascript-${JS}-${ARCH}.zip" -d protoc-gen-js && rm "protobuf-javascript-${JS}-${ARCH}.zip"
ENV PATH=$PATH:/protoc/bin/:/protoc-gen-js/bin
WORKDIR /repo
ENTRYPOINT [ "protoc", \
"--include_imports", \
"--include_source_info", \
"--proto_path", \
"./proto", \
"--descriptor_set_out", \
"api_descriptor.pb", \
"--plugin=protoc-gen-grpc-web=/protoc/bin/protoc-gen-grpc-web", \
"--js_out=import_style=es6:src/proto", \
"--grpc-web_out=import_style=typescript,mode=grpcwebtext:src/proto", \
"./proto/emulator_controller.proto", \
"./proto/rtc_service.proto" \
]