2
0

schema.sh 776 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. set -e
  3. export PROTOBUF_ROOT=$HOME/.local
  4. export WORKSPACE=$PWD
  5. # -----------------------------------------------------------------------------
  6. function generate_node() {
  7. echo "generate code for node"
  8. local target=$WORKSPACE/src/protocols
  9. if [ -d $target ]
  10. then
  11. rm -r $target
  12. fi
  13. mkdir -p $target
  14. grpc_tools_node_protoc -I $WORKSPACE/../protocols \
  15. -I $PROTOBUF_ROOT/include/google/protobuf \
  16. --js_out=import_style=commonjs,binary:$target \
  17. --grpc_out=grpc_js:$target $WORKSPACE/../protocols/morus.proto
  18. }
  19. # -----------------------------------------------------------------------------
  20. generate_node
  21. # -----------------------------------------------------------------------------
  22. echo 'done.'
  23. exit 0