Categorygithub.com/UNIwise/protobox
modulepackage
0.0.0-20200311132047-16b8249c7f25
Repository: https://github.com/uniwise/protobox.git
Documentation: pkg.go.dev

# README

protobox

protobox simplifies gRPC source generation and dependency management for your projects.

Keep track of proto files needed from folders or external git repos. Don't have protoc and all the plugins needed to generate your source files? No problem! protobox will use a docker image as a build host so you don't have to worry about the protoc build chain.

Installation

go get github.com/UNIwise/protobox

Quick start

# Display the help page
protobox help

# Initialize protobox.yaml
protobox init

# Add a proto dependency, target language 'go' and out directory 'gen'
protobox add https://github.com/UNIwise/protobox/blob/master/examples/service.proto go gen

# Add a proto local dependency, target language 'go' and out directory 'gen'
protobox add examples/service.proto go gen

# Generate your source files specified in protobox.yaml
protobox generate

# Use your local protoc binaries instead of the docker build host
protobox generate --local

# Check if your system have the needed dependencies for protobox to work
protobox check

# Lint the configuration file
protobox lint

Configuration

All protobox project dependencies and settings are specified in a protobox.yaml in the root of your project.

A simple configuration with a local proto file:

syntax: v1

services:
  - proto: service.proto
    out: 
      - language: go
        path: gen/

Proto files from git:

syntax: v1

services:
  - repo: [email protected]:UNIwise/protobox
    ref: master # optional, a branch or commit hash
    proto: examples/service.proto
    out: 
      - language: go
        path: gen/

Multiple target languages:

syntax: v1

services:
  - proto: service.proto
    out: 
      - language: go
        path: gen/go
      - language: php
        path: gen/php

Multiple services:

syntax: v1

services:
  - proto: service1.proto
    out: 
      - language: go
        path: gen/service1
  - proto: service2.proto
    out: 
      - language: go
        path: gen/service2

And of course all examples above can be combined as you please!

Syntax of protobox.yaml

Root

KeyInfoOptional
syntaxSpecifies the version of the syntax used. Available syntaxes are: v1no
builderSpecifies the docker image to use as build host. Defaults is wiseflow/protoboxyes
servicesA list of services to generate, see Servicesyes

Services

KeyInfoOptional
repoA git repository to retrieve a protobuf file fromyes
refA branch or commit id to checkout from gityes
protoThe path of the protobuf file to use. If no Repo is specified then proto is a local file.np
outA list of languages to generate services for, see Outno

Out

KeyInfoOptional
languageThe target language of the service. Available languages are: go, php, node, web, cpp, python, java, ruby and none. Use none to copy the proto file without generating source filesno
pathThe output path of the generated filesno

# Packages

No description provided by the author