zoukankan      html  css  js  c++  java
  • proto文件生成对应的js和ts文件

    安装protobuf

    先要安装node.js,然后用npm安装protobuf

    npm install -g protobufjs

    生成js文件

    单个文件

    pbjs -t static-module -w commonjs -o login.js login.proto

    所有文件

    pbjs -t static-module -w commonjs -o bundle.js *.proto

    其中*是把所有的proto整合到一个bundle.js中

    生成ts文件

    pbts -o bundle.d.ts bundle.js

    一键脚本

    新建protoc.sh文件,把文件放到和proto文件相同的文件夹里面,执行这个脚本就能生成bundle.jsbundle.d.ts文件了

    echo "generate bundle.js"
    pbjs -t static-module -w commonjs -o bundle.js *.proto && pbts -o bundle.d.ts bundle.js
    echo "done"
    
  • 相关阅读:
    template(2.2)
    Filter过滤链条
    The 3n + 1 problem
    Struts2.3+Spring4.0
    康托展开
    templates(2.1)
    templates(1.2)
    templates(1.1)
    我和你
    Android 的上下文菜单: Context Menu
  • 原文地址:https://www.cnblogs.com/bing6868/p/13866560.html
Copyright © 2011-2022 走看看