Skip to content
Snippets Groups Projects
Commit fda8127b authored by Tom French's avatar Tom French Committed by James Long
Browse files

docs: add documentation on how to build the protobuf

parent 908def39
No related branches found
No related tags found
No related merge requests found
# protobuf
We use [protobuf](https://developers.google.com/protocol-buffers/) to encode messages as binary data to send across the network.
## Generating protobuf ## 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.
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.
To generate the protobuf: I forget, will document this soon. ```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: 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: This will not work with our CSP directives. You must manually modify this to this:
``` ```
var global = globalThis; var global = globalThis;
``` ```
\ No newline at end of file
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
/** /**
* @fileoverview * @fileoverview
* @enhanceable * @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or * @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message. * field starts with 'MSG_' and isn't a translatable message.
* @public * @public
*/ */
// GENERATED CODE -- DO NOT EDIT! // GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf'); var jspb = require('google-protobuf');
var goog = jspb; var goog = jspb;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment