Giter Site home page Giter Site logo

protobuf-ts's Introduction

protobuf-ts

Protoc plugin to generate typescript client code from .proto files.

Build

  1. Make Build Directory.
  2. Change to build directory.
  3. cmake ..
  4. make
  5. Rename protobuf-ts to protoc-gen-protobuf-ts.
  6. Move protoc-gen-protobuf-ts to desired location.

Use

Make sure to include .exe on windows.

protoc --plugin=protoc-gen-protobuf-ts=path/to/protoc-gen-protobuf-ts.exe --protobuf-ts_out=name=YourNameSpaceHere:$OUT_DIR test.proto test1.proto test2.proto

Generator Options are as follows:

Name: the file name used for the output file, this is used with the A~1 ratio option.

protoc --plugin=protoc-gen-protobuf-ts=path/to/protoc-gen-protobuf-ts --protobuf-ts_out=name=YourNameSpaceHere:$OUT_DIR test.proto test1.proto test2.proto

Ratio: input to output ratio – if not used the default ratio is one output to each input file.

S~1 – print one file for each service definition.
A~1 – print one file from all input files.

protoc --plugin=protoc-gen-protobuf-ts=path/to/protoc-gen-protobuf-ts --protobuf-ts_out=ratio=S~1:$OUT_DIR test.proto

Deps: currently only used with the default one to one output.

  • Print – Prints each dependency in its own file. Then prints import statements for each dependency.
  • Import – Just prints the import statements for each dependency.
  • Include – Prints dependencies in the output file.

protoc --plugin=protoc-gen-protobuf-ts=path/to/protoc-gen-protobuf-ts --protobuf-ts_out=deps=print:$OUT_DIR test.proto

Services: print the generic service definitions or not – can be used with any output ratio.

protoc --plugin=protoc-gen-protobuf-ts=path/to/protoc-gen-protobuf-ts --protobuf-ts_out=services:$OUT_DIR test.proto

Client Library

gRPC-Web-Ts

protobuf-ts's People

Contributors

behunin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.