grpc tools node protoc ts
follow my repository for generate .protofile to javascript and typescript config
https://github.com/restuwahyu13/grpc-typescript-config
grpc tools node protoc ts
follow my repository for generate .protofile to javascript and typescript config
https://github.com/restuwahyu13/grpc-typescript-config
grpc tools node protoc
GRPC_TOOLS=$(exec grpc_tools_node_protoc)
INPUT_DIR="./src/protos"
INPUT_DIR_FILE="./src/protos/*.proto"
OUTPUT_DIR="./src/typedefs"
FIND_FILE=$(find ${OUTPUT_DIR} -name "*.js")
PROTOC_GEN_TS_PATH_WINDOWS="./node_modules/.bin/protoc-gen-ts.cmd"
PROTOC_GEN_TS_PATH_LINMAC="./node_modules/.bin/protoc-gen-ts"
if [ "$FIND_FILE" ]
then
#remove all files
$(rm ${OUTPUT_DIR}/*)
#generate config if file exist
${GRPC_TOOLS} \
--plugin=protoc-gen-ts=${PROTOC_GEN_TS_PATH_WINDOWS} \
--grpc_out=grpc_js:${OUTPUT_DIR} \
--js_out=import_style=commonjs,binary:${OUTPUT_DIR} \
--ts_out=grpc_js:${OUTPUT_DIR} \
--proto_path ${INPUT_DIR} ${INPUT_DIR_FILE}
else
#generate config if file not exist
${GRPC_TOOLS} \
--plugin=protoc-gen-ts=${PROTOC_GEN_TS_PATH_WINDOWS} \
--grpc_out=grpc_js:${OUTPUT_DIR} \
--js_out=import_style=commonjs,binary:${OUTPUT_DIR} \
--ts_out=grpc_js:${OUTPUT_DIR} \
--proto_path ${INPUT_DIR} ${INPUT_DIR_FILE}
fi
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us