/prototool

Your Swiss Army Knife for Protocol Buffers

Primary LanguageGoMIT LicenseMIT

prototool

This repository is a fork uber/prototool.

Add new plugins

Name Version
protoc-gen-go 1.27.1
protoc-gen-go-grpc 1.2.0
protoc-gen-validate 0.6.2
grpc-tools 1.11.2
ts-protoc-gen 0.15.0

Configuration

Example prototool.yaml wich generates both Golang code:

protoc:
  version: 3.19.4
lint:
  group: uber2
generate:
  go_options:
    import_path: github.com/citilink/prototool/example/proto
  plugins:
    - name: go
      type: go
      output: ../gen
    - name: go-grpc
      type: go
      output: ../gen
    - name: validate
      type: go
      flags: lang=go
      output: ../gen

Example prototool.yaml wich generates both NodeJS and browser code:

protoc:
  version: 3.19.4
lint:
  group: uber2
generate:
  plugins:
    # Shared
    - name: js
      flags: import_style=commonjs,binary
      output: ../gen
    # Node
    - name: grpc
      flags: grpc_js
      output: ../gen
      path: grpc_node_plugin
    - name: ts
      flags: service=grpc-node,mode=grpc-js
      output: ../gen
      path: protoc-gen-ts
    # Browser
    - name: grpc-web
      flags: import_style=commonjs+dts,mode=grpcwebtext
      output: ../gen
      path: protoc-gen-grpc-web

Docker build

x86_64

docker build -t "citilink/prototool:latest" .

aarch64

docker build --platform=linux/x86_64 -t "citilink/prototool:latest" .

How to use

x86_64

docker run --rm -v "$(pwd):/work" citilink/prototool:latest prototool generate

aarch64

docker run --rm --platform=linux/x86_64 -v "$(pwd):/work" citilink/prototool:latest prototool generate

Documentation

For more information please refer to the original documentation.