1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 17:44:59 +09:00
Shared library for Anytype clients https://anytype.io
Find a file
2019-09-26 22:56:33 +03:00
build .gitignore to the build repos added 2019-09-19 00:39:49 +03:00
common first iteration 2019-09-19 13:17:19 +03:00
dist lib.so moved to dist/ and updated 2019-09-26 22:56:33 +03:00
docs userstory updated 2019-09-19 00:45:38 +03:00
jsaddon services merge 2019-09-24 16:51:14 +03:00
lib lib.so moved to dist/ and updated 2019-09-26 22:56:33 +03:00
pb ImageGetBlob 2019-09-26 13:19:32 +03:00
ts proto: builder 2019-09-18 19:44:42 +03:00
.gitattributes lib.so moved to dist/ and updated 2019-09-26 22:56:33 +03:00
.gitignore first iteration 2019-09-19 13:17:19 +03:00
go.mod fix recover and add more tests 2019-09-26 22:52:56 +03:00
go.sum fix recover and add more tests 2019-09-26 22:52:56 +03:00
Makefile fix recover and add more tests 2019-09-26 22:52:56 +03:00
package.json pbjs|pbts local path 2019-09-24 19:39:24 +03:00
README.md build -> gitignore; protocol changes 2019-09-16 18:48:48 +03:00

Run example

Preconditions

  1. Install ts-node: sudo npm i -g ts-node to run .ts files in one step.
  2. Install js packages: npm i.
  3. Generate static ts/go modules from the .protocol files.

Then, simply run

  1. npm run start@go
  2. npm run start@ts

TS <- Proto generation

pbjs -t static-module -w commonjs -o build/ts/event.js event.proto
pbts -o build/ts/event.d.ts build/ts/event.js

Additionally, TypeScript definitions of static modules are compatible with their reflection-based counterparts (i.e. as exported by JSON modules), as long as the following conditions are met:

  1. Instead of using new SomeMessage(...), always use SomeMessage.create(...) because reflection objects do not provide a constructor.
  2. Types, services and enums must start with an uppercase letter to become available as properties of the reflected types as well (i.e. to be able to use MyMessage.MyEnum instead of root.lookup("MyMessage.MyEnum")).

GO <- Proto generation

protoc -I protocol/ protocol/event.proto --go_out=plugins=grpc:protocol/build/go