grpc-protobufjs-devtools grpc-protobufjs-devtools

Developer Tools
Version: 0.0.3
Last Update: 2019-06-21

Overview

grpc-protobufjs-devtools is a Chrome extension developed by ttshangxiang. According to the data from Chrome web store, current version of grpc-protobufjs-devtools is 0.0.3, updated on 2019-06-21.
496 users have installed this extension. 1 users have rated this extension with an average rating of .

grpc, proto, protobufjs, devtools, chrome, extensions

### use
1, 使用node和protobufjs创建proto.js。
``` javascript
const pbjs = require("protobufjs/cli/pbjs");
const fs = require('fs');
const path = require('path');
const glob = require('glob');

const protoPath = 'src/proto/**/*.proto'; // origin path
const protos = glob.sync(protoPath);

pbjs.main([ "--target", "json-module", "-w", "commonjs", ...protos], function(err, output) {
if (err)
throw err;
// target path
fs.writeFileSync(path.resolve(__dirname, './src/xxx/proto.js'), output);
});
```
2, 挂载json字符串到window。
``` javascript
const $root = require('./src/xxx/proto.js');
window.__DEVTOOLS_PROTO_JSON_STRING__ = JSON.stringify($root.toJSON({keepComments: true}));
```

Rating

1 ratings

Total Installs

496

Information

Last Update

2019-06-21

Current Version

0.0.3

Size

301KiB

Author

ttshangxiang

Website

None

Category

Developer Tools

Latest Reviews

See More