Adds Protobuf Impl

This commit is contained in:
2024-05-21 15:36:04 -06:00
parent 36712557cb
commit f5655a51ad
8 changed files with 968 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
NIX := "LD_LIBRARY_PATH='' nix"
PROTOBUF_DIR := "$PWD/protobuf"
prettier-gql:
#!/usr/bin/env bash
@@ -12,3 +13,27 @@ gql-codegen:
gql: gql-codegen prettier-gql
protobuf-compile-a-python name:
protoc -I={{ PROTOBUF_DIR }} --python_out={{ PROTOBUF_DIR }}/python --pyi_out={{ PROTOBUF_DIR }}/python {{ PROTOBUF_DIR }}/shot.proto
protobuf-compile-a-js name:
#!/usr/bin/env bash
set -euxo pipefail
{{NIX}} develop --impure --command bash -c 'yarn pbjs {{ PROTOBUF_DIR }}/shot.proto --ts {{ PROTOBUF_DIR }}/ts/shot.ts'
protobuf-compile-all-js:
#!/usr/bin/env bash
for proto in $(find {{ PROTOBUF_DIR }} -iname '*.proto'); do
name=$(basename "$proto" .proto)
just protobuf-compile-a-js $name
done
protobuf-compile-all-python:
#!/usr/bin/env bash
for proto in $(find {{ PROTOBUF_DIR }} -iname '*.proto'); do
name=$(basename "$proto" .proto)
just protobuf-compile-a-python $name
done
protobuf-compile-everything: protobuf-compile-all-js protobuf-compile-all-python