railbird-gql/justfile
Mike Kalange 30e356e3e0 Add Protobuf with Testing + Codegen (#7)
Reviewed-on: #7
Reviewed-by: Ivan Malison <ivanmalison@gmail.com>
Co-authored-by: Mike Kalange <countablecloud@gmail.com>
Co-committed-by: Mike Kalange <countablecloud@gmail.com>
2024-05-22 11:27:54 -06:00

39 lines
1.2 KiB
Makefile

NIX := "LD_LIBRARY_PATH='' nix"
PROTOBUF_DIR := "$PWD/rbproto"
prettier-gql:
#!/usr/bin/env bash
set -euxo pipefail
{{NIX}} develop --impure --command prettier ./src --write
gql-codegen:
#!/usr/bin/env bash
set -euxo pipefail
{{NIX}} develop --impure --command bash -c 'yarn install && yarn graphql-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 && yarn prettier ./rbproto --write'
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