插件小屋
grpc-protobufjs-devtools

grpc-protobufjs-devtools

0.0.3
2024-01-23
4
3.5
grpc-protobufjs-devtools - 截图 1

插件介绍

grpc、proto、protobufjs、devtools、chrome、扩展

### 使用
1、使用node和protobufjs创建proto.js。
``` JavaScript
const pbjs = require("protobufjs/cli/pbjs");
const fs = require('fs');
const 路径 = require('路径');
const glob = require('glob');

const protoPath = 'src/proto/**/*.proto'; // 原始路径
const protos = glob.sync(protoPath);

pbjs.main([ "--target", "json-module", "-w​​", "commonjs", ...protos], 函数(err, 输出) {
如果(错误)
抛出错误;
// 目标路径
fs.writeFileSync(path.resolve(__dirname, './src/xxx/proto.js'), 输出);
});
````
2、挂载json字符串到窗口。
``` JavaScript
const $root = require('./src/xxx/proto.js');
window.__DEVTOOLS_PROTO_JSON_STRING__ = JSON.stringify($root.toJSON({keepComments: true}));
````


插件详情

评分
3.5星(共5星),共2位用户参与评分
使用人数536
版本0.0.3
文件大小301KB
提供方ttshangxiang
支持语言中文 (简体)
IDhlpccefinpildddaohjbonjdddnefnmg
发布时间2024-01-23 10:51:19