docs: add documentation on how to build the protobuf
This commit is contained in:
parent
908def3957
commit
fda8127b4e
2 changed files with 19 additions and 4 deletions
|
@ -1,13 +1,25 @@
|
|||
# protobuf
|
||||
|
||||
We use [protobuf](https://developers.google.com/protocol-buffers/) to encode messages as binary data to send across the network.
|
||||
|
||||
## Generating protobuf
|
||||
|
||||
We use protobuf to encode messages as binary data to send across the network.
|
||||
The protobuf is generated by using the [protoc](https://github.com/protocolbuffers/protobuf) compiler.
|
||||
|
||||
To generate the protobuf: I forget, will document this soon.
|
||||
This can be installed by downloading one of the [pre-built binaries](https://github.com/protocolbuffers/protobuf/releases/) and placing it in your `$PATH`. The version used to build the current protobuf is [v3.20.1](https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.1).
|
||||
|
||||
Once installed, the protobuf can be generated by running the below commands.
|
||||
|
||||
```bash
|
||||
cd packages/loot-core/src/server/sync
|
||||
|
||||
protoc sync.proto --js_out=import_style=commonjs,binary:proto
|
||||
```
|
||||
|
||||
However there is one very important thing to remember! The default output includes this near the top:
|
||||
|
||||
```
|
||||
var global = Function('return this')();
|
||||
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
|
||||
```
|
||||
|
||||
This will not work with our CSP directives. You must manually modify this to this:
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
/**
|
||||
* @fileoverview
|
||||
* @enhanceable
|
||||
* @suppress {missingRequire} reports error on implicit type usages.
|
||||
* @suppress {messageConventions} JS Compiler reports an error if a variable or
|
||||
* field starts with 'MSG_' and isn't a translatable message.
|
||||
* @public
|
||||
*/
|
||||
// GENERATED CODE -- DO NOT EDIT!
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
var jspb = require('google-protobuf');
|
||||
var goog = jspb;
|
||||
|
|
Loading…
Reference in a new issue