combine proto scripts
This commit is contained in:
parent
559461b2c9
commit
a1e7af7ad1
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
# NOTE: protoc is required
|
||||
|
||||
I=$(pwd)/proto
|
||||
DEST_TS=$(pwd)/src/proto/
|
||||
mkdir -p $DEST_TS
|
||||
|
||||
protoc \
|
||||
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
|
||||
--ts_out=$DEST_TS \
|
||||
--proto_path=$I \
|
||||
$(find $(pwd)/proto/vulcanize -iname "*.proto")
|
39
scripts/proto-gen.sh
Executable file
39
scripts/proto-gen.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# NOTE: protoc is required
|
||||
|
||||
set -e
|
||||
|
||||
REPO_ROOT=$(pwd)
|
||||
I=$REPO_ROOT/proto
|
||||
DEST_TS=$REPO_ROOT/src/proto/
|
||||
|
||||
echo "Generating protobuf files"
|
||||
|
||||
mkdir -p $DEST_TS
|
||||
|
||||
protoc \
|
||||
--plugin=protoc-gen-ts=$REPO_ROOT/node_modules/.bin/protoc-gen-ts \
|
||||
--ts_out=$DEST_TS \
|
||||
--proto_path=$I \
|
||||
$(find $REPO_ROOT/proto/vulcanize -iname "*.proto")
|
||||
|
||||
SED='sed -i'
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
SED='sed -i ""'
|
||||
fi
|
||||
|
||||
echo "Removing gRPC references..."
|
||||
|
||||
for file in $(find $REPO_ROOT/src/proto -type f)
|
||||
do
|
||||
line=$(grep -n '@grpc/grpc-js' $file | cut -f1 -d':')
|
||||
if [[ -n "$line" ]] && [[ "$line" -gt 0 ]]; then
|
||||
echo "Processing file: $file"
|
||||
$SED "${line}d" ${file}
|
||||
functions=$(grep -n 'interface GrpcUnaryServiceInterface' $file | cut -f1 -d':')
|
||||
$SED "${functions},\$d" ${file}
|
||||
echo '}' >> $file
|
||||
fi
|
||||
$SED '1s#^#/* eslint-disable */\n#' $file
|
||||
$SED '1s#^#// @ts-nocheck\n#' $file
|
||||
done
|
@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo $PWD
|
||||
for file in $(find src/proto -type f)
|
||||
do
|
||||
line=$(grep -n '@grpc/grpc-js' $file | cut -f1 -d':')
|
||||
if [[ $line -gt 0 ]];
|
||||
then
|
||||
echo "Processing file... $file"
|
||||
sed -i "${line}d" ${file}
|
||||
functions=$(grep -n 'interface GrpcUnaryServiceInterface' $file | cut -f1 -d':')
|
||||
sed -i "${functions},\$d" ${file}
|
||||
echo '}' >> $file
|
||||
fi
|
||||
sed -i '1s#^#/* eslint-disable */\n#' $file
|
||||
sed -i '1s#^#// @ts-nocheck\n#' $file
|
||||
done
|
Loading…
Reference in New Issue
Block a user