When adding a template to a project that has multiple type definition files defined in graphcool.yml, the graphcool add-template command merges all type definitions into the first file defined in the types list.
Reproduction
Create a new graphcool project.
Create multiple types files and list them under types in graphcool.yml
Add a template using graphcool add-template (e.g. graphcool add-template graphcool/templates/auth/auth0
Open ./types/Authors.graphql. Notice that the contents of Posts.graphql and the commented-out types from the auth0 template have been added to Authors.graphql
Expected behavior?
I can see two possible options in a project with multiple type files:
Append the imported types to the first file in the list, but do not append the other types from the project.
Create a new types file named after the template. This could be difficult becuase there is no standard file structure defined by Graphcool – where would it put the file? Project root is probably the safest. Given that types are added commented-out, the new file could be added commented-out to the types list as well, or just left to the developer to add manually.
Issue by grahamb Friday Dec 01, 2017 at 23:57 GMT Originally opened as https://github.com/graphcool/prisma/issues/1356
Current behavior
When adding a template to a project that has multiple type definition files defined in
graphcool.yml
, thegraphcool add-template
command merges all type definitions into the first file defined in thetypes
list.Reproduction
types
ingraphcool.yml
graphcool add-template
(e.g.graphcool add-template graphcool/templates/auth/auth0
./types/Authors.graphql
. Notice that the contents of Posts.graphql and the commented-out types from the auth0 template have been added toAuthors.graphql
Expected behavior?
I can see two possible options in a project with multiple type files: