railbird-gql/justfile

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