grpc-protobufjs-devtools

grpc-protobufjs-devtools

使用node和protobufjs创建proto.js,挂载json字符串到window,让您轻松管理您的插件!

691

更新日期:2019 年 6 月 21 日分类标签:平台:没限制

301KiB 523 人已下载

grpc-protobufjs-devtools 插件安装教程:


扩展迷 | chrome插件下载与安装教程(图文讲解,全网最详细)

grpc-protobufjs-devtools 插件简介:

### 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}));
“`

grpc-protobufjs-devtools 插件ID:

hlpccefinpildddaohjbonjdddnefnmg

grpc-protobufjs-devtools 插件最新版本:

0.0.3

相关导航

暂无评论

暂无评论...