Coder Social home page Coder Social logo

ondewo / ondewo-proto-compiler Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 174 KB

ONDEWO PROTO COMPILER is a collection of docker images for the purpose of creating installable client packages from the protocol buffer definition (.proto) files for several programming languages (e.g. python, js, nodejs, typescript, angular,...)

License: Apache License 2.0

Dockerfile 8.40% Shell 72.05% JavaScript 6.80% Makefile 12.76%
protobuf protobuf3 protobuf-compiler ondewo protobuffer protobuff compiler proto docker-image docker

ondewo-proto-compiler's Introduction

ONDEWO Logo

Ondewo Proto Compiler

A collection of docker images for the purpose of creating installable client packages from the protcol buffer definition (.proto) files.

Platforms

The ondewo proto compiler docker images are available for following target platforms:

Angular

Uses ngx-grpc's protoc-gen-ng to compile the .proto files of the source directory to injectable typescript services and classes for to use as a client.
Then proceeds to package these classes to a npm installable grpc client library using ng-packagr and the angular compiler.

Also creates a npm-folder which can be published to NPM by running npm run publish-npm in the src folder of the corresponding project. (IMPORTANT: Check the versions in the package.json and RELEASE.md files. These versions should match the GitHub release.)

(Vanilla) - Javascript

Also uses grpc-web to compile the protobuf defs to commonjs.
Then uses webpack to transpile the commonjs classes to a single vanilla javascript that can be included from a <\script>-tag of a webpage.

Node.js

Uses the npm grpc-tools and grpc_tools_node_protoc_ts to compile the .proto files of the source directory to commonjs service/classes and type definitions to consume those classes in a node client. (uses commonjs,binary options for performant communication)
Then proceeds to create an entry point file for all resulting classes and creates an npm installable typescript package.

Typescript

Uses the grpc-web protobuf compiler plugin to compile the .proto files of the source directory to commonjs service/classes and type definitions to consume those classes in typescript. (uses commonjs,binary options for performant communication)
Then proceeds to create an entry point file for all resulting classes and creates an npm installable typescript package.

How to use?

Requirements

  • Docker:

    #Removing old versions
    sudo apt-get remove docker docker-engine docker.io
    #Ubuntu
    sudo apt install containerd docker.io
    sudo systemctl start docker
    sudo systemctl enable docker

On Windows using Windows Subsystem for Linux (WSL) is recommended, to prevent any compability issues.

Building the docker images

bash angular/build.sh
bash js/build.sh
bash nodejs/build.sh
bash typescript/build.sh

Creates the following image tags:

  • Angular: ondewo-angular-proto-compiler
  • Javascript: ondewo-js-proto-compiler
  • Node.js: ondewo-nodejs-proto-compiler
  • Typescript: ondewo-typescript-proto-compiler

Using the docker images to consume .proto directories and create platform specific client packages

Examples of usage can be found in:

  • angular/example
  • js/example
  • nodejs/example

Where the script run-compile.sh performs the .proto to package compilation.

To compile a package following format should be followed:

docker run -it -v $FILEDIRECTORY:/input-volume -v $FILEDIRECTORY/lib:/output-volume ondewo-angular-proto-compiler protos
  • -it Interactive terminal to show the output of the compilation process in the active terminal
  • -v specifies the input directory to mount and consume for the compilation (path after the :)
  • -v specifies the output directory where the resulting package files are copied to
  • Tag of the docker image to be used (options according to the corresponding image tags as specified above)
  • Relative path to the input volume where the .proto files are located

ondewo-proto-compiler's People

Contributors

ahasanovicc avatar fergusfettes avatar gaborod16 avatar phips0812 avatar rinjac avatar rinjac-ondewo avatar teddius avatar

Stargazers

 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.