Shopify / graphql-js-schema

Transforms the JSON representation of a GraphQL schema into a set of ES6 type modules
MIT License
35 stars 12 forks source link

[WIP] all the code. #1

Closed minasmart closed 8 years ago

minasmart commented 8 years ago

Extracting es6 module generation from js buy into its own thing

minasmart commented 8 years ago

@swalkinshaw @tessalt @mikkoh wanna have a look?

This is the thing that actually extracts types from a json schema and bundles them up. This is just the API, no CLI yet.

I know it's big, but a large number of the files are just really terse predicate functions or test fixtures.

minasmart commented 8 years ago

Regarding the babel generators: It just saves some effort over properly escaping values, and gives a hint as to wether we're generating valid code.

I was doing this all with string interpolation before, but this gives some better guarantees.

The fact that we're using babel also allows us to ensure we're matching whatever a client environment targets, babel-plugin wise. I haven't exposed params yet, but we could easily return the AST for everything and let people generate using whatever plugin set they like 😄 .