Skip to content
Snippets Groups Projects
user avatar
Jed Fox authored
Fixes #615. I would appreciate double-checking that I didn’t
accidentally delete anything that is important.

Since I’m removing the related API methods, this is technically a
breaking change (even if people would have no reason to remove this
stuff), so we should probably do a major release of the API package.
646d0d90
History

protobuf

We use protobuf to encode messages as binary data to send across the network.

Generating protobuf

The protobuf is generated by using the protoc compiler.

This can be installed by downloading one of the pre-built binaries and placing it in your $PATH. The version used to build the current protobuf is v3.20.1.

Once installed, the protobuf can be generated by running the below commands.

cd packages/loot-core

protoc --plugin="protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts" \
    --ts_opt=esModuleInterop=true \
    --ts_out="src/server/sync/proto" \
    --js_out=import_style=commonjs,binary:src/server/sync/proto \
    --proto_path=src/server/sync \
    sync.proto

However there is one very important thing to remember! The default output includes this near the top:

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:

var global = globalThis;