Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.05 KB

EXAMPLE.md

File metadata and controls

39 lines (27 loc) · 1.05 KB

parse-proto example usage

Be sure to check out the readme first.

Instructions

Clone the repository and install dependencies if you haven't already:

$ git clone -b main https://github.com/sokkit-io/parse-proto.git
$ cd ./parse-proto
$ npm install

Now, check out the proto/in directory contents. You'll see an entity.proto file with proto messages and a service. This is the file we'll be parsing.

Next, we'll make one small change to parse-proto.ts on line 10 to see how it works with our sample .proto file:

- const ENV_FILE = '.env';
+ const ENV_FILE = '.env.example';

Finally, run the parse-proto script:

$ npm run parse-proto

Output

The output of the parse-proto script is a compiled JavaScript module and TypeScript definition.

$ cd ./example/out && ls
entity.1_0_0.compiled.proto.js  entity.1_0_0.compiled.proto.d.ts

You can then copy the compiled JavaScript module and TypeScript definition to your project and use them as you see fit.