Fix Node.js gen scripts

This commit is contained in:
Nex 2020-03-15 10:47:53 +08:00
parent 45081f759e
commit 5ae9bb3cb3
2 changed files with 15 additions and 12 deletions

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash
cd "${0%/*}/.."
dir=gen/nodejs
plugin=`which grpc_tools_node_protoc_plugin`
pluginPath=$(which grpc_tools_node_protoc_plugin)
mkdir -p $dir
%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/common.proto
%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/error_details.proto
%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/node.proto
%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/ledger.proto
%exe% --js_out=import_style=commonjs,binary:%dir --grpc_out=%dir --plugin=protoc-gen-grpc=$plugin bdledger/api/query.proto
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/common.proto
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/error_details.proto
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/node.proto
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/ledger.proto
protoc -I . --js_out=import_style=commonjs,binary:$dir --grpc_out=$dir --plugin=protoc-gen-grpc="$pluginPath" bdledger/api/query.proto

View File

@ -2,15 +2,18 @@
cd /d "%~dp0.."
set dir=.\gen\nodejs
set exe=grpc_tools_node_protoc
for /f %%i in ('where grpc_tools_node_protoc_plugin') do set plugin=%%i
set plugin=grpc_tools_node_protoc_plugin
where /q %exe% || echo missing %exe% && exit /B
where /q %plugin% || echo missing %plugin% && exit /B
for /f %%i in ('where %plugin%') do set pluginPath=%%i
if not exist %dir% mkdir %dir%
call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/common.proto
call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/error_details.proto
call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/node.proto
call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/ledger.proto
call %exe% --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%plugin% bdledger/api/query.proto
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/common.proto
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/error_details.proto
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/node.proto
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/ledger.proto
call %exe% -I . --js_out=import_style=commonjs,binary:%dir% --grpc_out=%dir% --plugin=protoc-gen-grpc=%pluginPath% bdledger/api/query.proto
echo all done