Currently, I am working with a monorepo that is utilizing nxCloud. Within the root directory of this repository, I have created a proto file inside a specific folder. This proto file is essential for its functionality but in order to utilize its functions, I need to import it as a TypeScript file. To achieve this conversion, I am attempting to write an sh script which will be executed using git bash. However, I am encountering errors related to the paths of my source and destination folders. My lack of expertise in .sh files is hindering me from pinpointing the exact issue. I require assistance in executing this script.
Below is the snippet of the sh code:
#!/bin/bash
BASEDIR=$(dirname "$0")
cd ${BASEDIR}/../
PROTO_DEST=./src/proto
mkdir -p ${PROTO_DEST}
# JavaScript code generation
yarn run grpc_tools_node_protoc \
--js_out=import_style=commonjs,binary:${PROTO_DEST} \
--grpc_out=${PROTO_DEST} \
--plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin.cmd \
-I ./proto \
proto/*.proto
echo issueOccuredHere
# TypeScript code generation
yarn run grpc_tools_node_protoc \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts.cmd \
--ts_out=${PROTO_DEST} \
-I ./proto \
proto/*.proto
The error messages are visible in the screenshots provided below:
https://i.sstatic.net/ZY01f.png
To better understand the file levels within this project, refer to the image linked here: