Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example that illustrates modular typeDef and resolvers file organization #224

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

jboothe
Copy link
Contributor

@jboothe jboothe commented Mar 23, 2018

This example illustrates how one could organize typeDef and resolver files in any manner and merge them using merge-graphql-schemas.
Closes #136
Closes #214

@jboothe
Copy link
Contributor Author

jboothe commented Mar 23, 2018

@marktani In my haste, I submitted this PR on master. Would you prefer I submit it as a feature branch?

@corydeppen
Copy link
Contributor

Compiling a project with tsc using this approach fails to include the .graphql files, which causes a run-time error Specified query type "Query" not found in document. I was wondering what your approach might look like to ensure the .graphql files are included in the output directory so they're available to fileLoader.

Based on the response in Urigo/merge-graphql-schemas#119, it seems like building for production using .graphql files hasn't been explored yet or it may be an exercise left for the library consumer to figure out.

/cc @cfnelson

@timsuchanek
Copy link
Contributor

Thanks for the PR @jboothe ! @corydeppen yes, we're for example using this in a graphql server we're running:

  "scripts": {
    "build": "rimraf dist && tsc && copyfiles -u 1 src/**/**/*.{graphql,json} dist/",
  }

Feel free to do another PR to add that :)

@timsuchanek timsuchanek merged commit 18c97fb into dotansimha:master Apr 5, 2018
@cfnelson
Copy link

cfnelson commented Apr 6, 2018

@corydeppen Sorry for not noticing your comment here earlier. Just wanted to thank you for cc'ing me 🙌 ! It's been quite helpful in giving me more context and clarifying some of my own confusion with issues/questions some users have raised on merge-graphql-schemas.

The fileLoader could definitely be improved further as there are a few issues around it depending on your server env/build process etc. currently it is up to the end user to ensure the .graphql files are available to you in your production bundle. I suspect this might be a common pitfall for some users who have builds that use tree-shaking and are not including the .graphql files.

Always love to see/hear how people are consuming the merge-graphql-schemas library. So please feel free to open an issue and let us know your use cases/pain-points and how we could potentially improve the pkg. Always looking for more contributors as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modularized Resolvers and TypeDefs - Error: typeDefs.reduce is not a function server example with modules
4 participants