Use graphql with file-contents instead of file names
Luke1298 opened this issue · comments
In order to get shadow cljs to hot reload with defgraphql
it would be nice if there was another macro that did all but the "read file" step of defgraphql
-- or alternatively a flag or something.
(Shadow cljs supports a "rc/inline" which handles setting up a watch on a file, but it also reads said file)
Happy to make PR if you think it's a good idea!
Hmmm... Actually I played around with this-- it seems like: https://github.com/alumbra/alumbra.parser
would first have to have a method to handle a string rather than a file.
Turns out putting a list of: (rc/inline "operation1.graphql") will actually cause a namespace reload anyway. So this is probably completely unnecessary.
@Luke1298 what is rc
namespace in this case?
It is shaodw.resource
.
(ns my-stuff
(:require
[graphql-builder.parser :refer-macros [defgraphql]]
[shadow.resource :as rc]))
(rc/inline "operations.graphql")
(defgraphql gql-queries "src/graphql_ops/operations.graphql")
(def gql-query-map (gql/query-map gql-queries {:inline-fragments true}))
@retro ^^ What @heneryville said... Sorry for the lack of response.