All Projects → SINTEF-9012 → Proto2TypeScript

SINTEF-9012 / Proto2TypeScript

Licence: MIT license
Generate TypeScript definitions from a Protocol Buffers model

Programming Languages

javascript
184084 projects - #8 most used programming language
Protocol Buffer
295 projects
typescript
32286 projects
shell
77523 projects

Proto2TypeScript

This tool generate TypeScript definitions for your Protocol Buffers models, when you use the excellent ProtoBuf.js library.

Usage

# Install the dependencies
npm install --production

# Parse and convert the proto file to json using pbjs (from ProtoBuf.js)
node_modules/protobufjs/bin/pbjs model.proto > model.json

# Convert the model to TypeScript definitions
node command.js --file model.json > model.d.ts

Options

Options:
  -f, --file              The JSON file                                       [required]
  -c, --camelCaseGetSet   Generate getter and setters in camel case notation  [default: true]
  -u, --underscoreGetSet  Generate getter and setters in underscore notation  [default: false]
  -p, --properties        Generate properties                                 [default: true]
  -t, --templateDir       Template directory                                  [default: __dirname]

Why ?

Because intelligent code completion is cool :-)

Requirements

It is a Node.js project. The sourcecode is written in TypeScript, but the JavaScript output is present in the repository.

If you want to run the tests, you need bash, mocha and typescript.

Acknowledgements

This code is developed in context of the BRIDGE project.

Licence

The source code of this tool is licenced under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].