Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 \
  15. ext/customer.graphql \
  16. \
  17. ext/gqlgen.graphql \
  18. ext/enum.graphql \
  19. ext/error.graphql \
  20. ext/interface.graphql \
  21. ext/localization.graphql \
  22. ext/location.graphql \
  23. ext/page.graphql \
  24. ext/property.graphql \
  25. ext/publication.graphql \
  26. ext/scalar.graphql \
  27. ext/translation.graphql \
  28. ext/union.graphql \
  29. \
  30. ext/app.graphql \
  31. ext/company.graphql \
  32. ext/delivery.graphql \
  33. ext/event.graphql \
  34. ext/mail.graphql \
  35. ext/marketing.graphql \
  36. ext/media.graphql \
  37. ext/meta.graphql \
  38. ext/money.graphql \
  39. ext/order.graphql \
  40. ext/product.graphql \
  41. ext/rbac.graphql \
  42. ext/shop.graphql \
  43. > subgraph/customer.graphql
  44. @cat subgraph/product.tpl \
  45. ext/product.graphql \
  46. \
  47. ext/gqlgen.graphql \
  48. ext/enum.graphql \
  49. ext/error.graphql \
  50. ext/interface.graphql \
  51. ext/localization.graphql \
  52. ext/location.graphql \
  53. ext/page.graphql \
  54. ext/property.graphql \
  55. ext/publication.graphql \
  56. ext/scalar.graphql \
  57. ext/translation.graphql \
  58. ext/union.graphql \
  59. \
  60. ext/app.graphql \
  61. ext/company.graphql \
  62. ext/customer.graphql \
  63. ext/delivery.graphql \
  64. ext/event.graphql \
  65. ext/fulfillment.graphql \
  66. ext/marketing.graphql \
  67. ext/media.graphql \
  68. ext/meta.graphql \
  69. ext/money.graphql \
  70. ext/order.graphql \
  71. ext/rbac.graphql \
  72. ext/shop.graphql \
  73. > subgraph/product.graphql
  74. @cat subgraph/shop.tpl \
  75. ext/shop.graphql \
  76. \
  77. ext/gqlgen.graphql \
  78. ext/enum.graphql \
  79. ext/error.graphql \
  80. ext/event.graphql \
  81. ext/interface.graphql \
  82. ext/localization.graphql \
  83. ext/location.graphql \
  84. ext/page.graphql \
  85. ext/property.graphql \
  86. ext/publication.graphql \
  87. ext/scalar.graphql \
  88. ext/translation.graphql \
  89. ext/union.graphql \
  90. \
  91. ext/alert.graphql \
  92. ext/app.graphql \
  93. ext/channel.graphql \
  94. ext/company.graphql \
  95. ext/customer.graphql \
  96. ext/delivery.graphql \
  97. ext/fulfillment.graphql \
  98. ext/mail.graphql \
  99. ext/market.graphql \
  100. ext/marketing.graphql \
  101. ext/media.graphql \
  102. ext/meta.graphql \
  103. ext/money.graphql \
  104. ext/order.graphql \
  105. ext/product.graphql \
  106. ext/rbac.graphql \
  107. > subgraph/shop.graphql
  108. @cat subgraph/order.tpl \
  109. \
  110. ext/gqlgen.graphql \
  111. ext/enum.graphql \
  112. ext/error.graphql \
  113. ext/event.graphql \
  114. ext/interface.graphql \
  115. ext/localization.graphql \
  116. ext/location.graphql \
  117. ext/page.graphql \
  118. ext/property.graphql \
  119. ext/publication.graphql \
  120. ext/scalar.graphql \
  121. ext/translation.graphql \
  122. ext/union.graphql \
  123. \
  124. ext/alert.graphql \
  125. ext/app.graphql \
  126. ext/channel.graphql \
  127. ext/company.graphql \
  128. ext/customer.graphql \
  129. ext/delivery.graphql \
  130. ext/fulfillment.graphql \
  131. ext/mail.graphql \
  132. ext/marketing.graphql \
  133. ext/meta.graphql \
  134. ext/media.graphql \
  135. ext/money.graphql \
  136. ext/order.graphql \
  137. ext/product.graphql \
  138. ext/rbac.graphql \
  139. ext/shop.graphql \
  140. > subgraph/order.graphql
  141. @rover supergraph compose --config config.yaml > superschema.graphql
  142. .PHONY: add-context
  143. add-context:
  144. -@echo "-> $@"
  145. @sed -r '/directive @inContext(.+)/d' superschema.graphql > prod.graphql
  146. @echo -e "\n\n$$(cat ext/in_context.graphql)" >> prod.graphql
  147. @cp prod.graphql superschema.graphql
  148. @sed 's/type Query/type Query\n @inContext/' superschema.graphql > prod.graphql
  149. @cp prod.graphql superschema.graphql
  150. @sed 's/type Mutation/type Mutation\n @inContext/' superschema.graphql > prod.graphql
  151. @rm superschema.graphql
  152. .PHONY: generate
  153. generate:
  154. -@echo "-> $@"
  155. -rm -rf graph
  156. @go run gshopper.com/gshopify/admin-api/cmd -m all