@cldcvr/protobufjs-typescript-gen
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

@cldcvr/protobufjs-typescript-gen

@cldcvr/protobufjs-typescript-gen is a tool which used protocol buffers to generate a Typescript interface. The tool is currently highly opinionated in how it generates files. It internally uses protobuf.js.

protobuf.js is a pure JavaScript implementation with TypeScript support for node.js and the browser. It's easy to use, blazingly fast and works out of the box with .proto files!

Installation

node.js

$> npm install @cldcvr/protobufjs-typescript-gen [--save --save-prefix=~]
// generate-protocol.js
const { generateProtocol } = require('@cldcvr/protobufjs-typescript-gen');

generateProtocol({
    protocolDir: 'YOUR_PROTOCOL_DIRECTORY',
    outDir: 'YOUR_OUTPUT_DIRECTORY',
});
$> node generate-protocol.js

Example

Please see the examples folder for the structure of the generated interface.

/@cldcvr/protobufjs-typescript-gen/

    Package Sidebar

    Install

    npm i @cldcvr/protobufjs-typescript-gen

    Weekly Downloads

    2

    Version

    2.0.4

    License

    MIT

    Unpacked Size

    35.2 kB

    Total Files

    21

    Last publish

    Collaborators

    • shubhamseervi
    • vikas-cldcvr
    • nikhilverma