Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Yoga generate command #116

Open
notrab opened this issue Mar 25, 2019 · 4 comments
Open

Yoga generate command #116

notrab opened this issue Mar 25, 2019 · 4 comments

Comments

@notrab
Copy link
Contributor

notrab commented Mar 25, 2019

Is your feature request related to a problem? Please describe.
#18 is a great start. Certainly removes a lot of the pain creating all those files and types yourself. The problem is if I just want createComment mutation I'd have to go through that full flow.

Describe the solution you'd like
Similar to how Rails does it with their generate command. It would be great to have a yoga generate command that does the following:

  • yoga generate type Comment field:type field2:type:required
  • yoga generate mutation createComment
  • yoga generate query Users

Additional context
Some of the Rails migration commands might be useful.

Very early idea... Thoughts welcome on how we could do this!

@guledali
Copy link

@notrab Doesn't graphql-ruby have something similar

rails g graphql:object Post id:ID! title:String! description:String!

@notrab
Copy link
Contributor Author

notrab commented Mar 26, 2019

@guledali Nice! graphql-ruby has matured a lot since I last used it. This kind of approach is gold 💯

@guledali
Copy link

guledali commented Apr 7, 2019

There is something like this already build in https://www.youtube.com/watch?v=3eoxXwllmpk&list=LL8bYS4kY0br718lE_ButosQ&index=9&t=311s

If you ran npm scaffold or yarn scaffold you should be able to create datamodel and then the graphql-type.

@notrab
Copy link
Contributor Author

notrab commented Apr 7, 2019

@guledali yeah I'm aware of that but this issue is suggesting we add short helpers instead of going through the scaffold command.

  • yoga generate type Comment field:type field2:type:required
  • yoga generate mutation createComment
  • yoga generate query Users

It doesn't look like too much work if we passed the args along to the inquirer.

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

No branches or pull requests

2 participants