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
build | ||
common | ||
dist | ||
docs | ||
jsaddon | ||
lib | ||
pb | ||
ts | ||
.gitattributes | ||
.gitignore | ||
go.mod | ||
go.sum | ||
Makefile | ||
package.json | ||
README.md |
Run example
Preconditions
- Install ts-node:
sudo npm i -g ts-node
to run.ts
files in one step. - Install js packages:
npm i
. - Generate static ts/go modules from the
.protocol
files.
Then, simply run
npm run start@go
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:
- Instead of using
new SomeMessage(...)
, always useSomeMessage.create(...)
because reflection objects do not provide a constructor. - 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 ofroot.lookup("MyMessage.MyEnum"))
.
GO <- Proto generation
protoc -I protocol/ protocol/event.proto --go_out=plugins=grpc:protocol/build/go