Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # See http://clarkgrubb.com/makefile-style-guide
  2. MAKEFLAGS += --warn-undefined-variables
  3. SHELL := bash
  4. .SHELLFLAGS := -eu -o pipefail -c
  5. .DEFAULT_GOAL := all
  6. .DELETE_ON_ERROR:
  7. .SUFFIXES:
  8. include .env
  9. .PHONY: all
  10. all: supergraph add-context generate
  11. .PHONY: supergraph
  12. supergraph:
  13. -@echo "-> $@"
  14. cat subgraph/customer.tpl ext/*.graphql > subgraph/customer.graphql
  15. cat subgraph/product.tpl ext/*.graphql > subgraph/product.graphql
  16. rover supergraph compose --config config.yaml > superschema.graphql
  17. .PHONY: add-context
  18. add-context:
  19. -@echo "-> $@"
  20. @sed -r '/directive @inContext(.+)/d' superschema.graphql > prod.graphql
  21. @echo -e "\n\n$$(cat ext/in_context.graphql)" >> prod.graphql
  22. @cp prod.graphql superschema.graphql
  23. @sed 's/type Query/type Query\n @inContext/' superschema.graphql > prod.graphql
  24. @cp prod.graphql superschema.graphql
  25. @sed 's/type Mutation/type Mutation\n @inContext/' superschema.graphql > prod.graphql
  26. @rm superschema.graphql
  27. .PHONY: generate
  28. generate:
  29. -@echo "-> $@"
  30. -rm -rf graph
  31. @go run gshopper.com/gshopify/admin-api/cmd -m customer
  32. @go run gshopper.com/gshopify/admin-api/cmd -m product