Add web platform
This commit is contained in:
parent
e402bf1ef2
commit
e94f067e26
@ -12,6 +12,12 @@
|
||||
go get -u google.golang.org/grpc
|
||||
go get -u github.com/golang/protobuf/protoc-gen-go
|
||||
```
|
||||
- Web
|
||||
```bash
|
||||
git clone https://github.com/grpc/grpc-web
|
||||
cd grpc-web
|
||||
sudo make install-plugin
|
||||
```
|
||||
|
||||
参考资料:
|
||||
|
||||
@ -21,4 +27,4 @@
|
||||
### 编译
|
||||
|
||||
- 在本项目打开控制台,或者切换工作路径到本项目
|
||||
- 执行 `./gen`
|
||||
- 执行 `./gen-{{platform}}`
|
||||
|
15
gen-web.bat
Normal file
15
gen-web.bat
Normal file
@ -0,0 +1,15 @@
|
||||
@echo off
|
||||
set dir=.\gen\web
|
||||
set exe=protoc
|
||||
set gen=protoc-protoc-gen-grpc-web
|
||||
|
||||
where /q %exe% || echo missing %exe% && exit /B
|
||||
where /q %gen% || echo missing %gen% && exit /B
|
||||
|
||||
if not exist %dir% mkdir %dir%
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdchain/api/common.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdchain/api/error_details.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdchain/api/tx_ledger.proto
|
||||
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdchain/api/ac_chain.proto
|
||||
|
||||
echo all done
|
7
gen-web.sh
Normal file
7
gen-web.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
dir=gen/web
|
||||
mkdir -p $dir
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdchain/api/common.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdchain/api/error_details.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdchain/api/tx_ledger.proto
|
||||
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdchain/api/ac_chain.proto
|
Loading…
Reference in New Issue
Block a user