Remove hard-coded record types #52

Merged
ashwin merged 11 commits from deep-stack/laconic-sdk:ng-rm-record-types into main 2024-01-15 04:58:56 +00:00
3 changed files with 39 additions and 28 deletions
Showing only changes of commit a1e7af7ad1 - Show all commits

View File

@ -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
View 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

View File

@ -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