aerogear / graphback

Graphback - Out of the box GraphQL server and client
https://graphback.dev
Apache License 2.0
409 stars 73 forks source link

Running `yarn graphback generate` from a fresh generated project using `graphback-cli init` fails #1543

Closed machi1990 closed 4 years ago

machi1990 commented 4 years ago

After successful generating a new project using our cli, we have the next steps printed in console

Next Steps:
1. Change directory into project folder - cd test
3. Review Graphback graphqlrc.yml config file
2. Edit the .graphql file inside your model folder.
3. Depending on template you might also need to run generator:
   "graphback generate" command to generate source code

However, when running the yarn graphback generate command it fails.

I think it is because the templates are missing the graphback-cli package

https://github.com/aerogear/graphback/blob/master/templates/ts-apollo-mongodb-backend/package.json#L14

https://github.com/aerogear/graphback/blob/master/templates/ts-apollo-postgres-backend/package.json#L14

https://github.com/aerogear/graphback/blob/master/templates/ts-react-apollo-client/package.json#L16

/cc @wtrocki @craicoverflow

craicoverflow commented 4 years ago

This is because it looks for a .graphqlrc file. We have removed that since server generation is completely runtime, however if you want to generate client documents you need a config file.

However, I believe work has begun to create an offix-cli (https://github.com/aerogear/offix/issues/525) So the generate command will be removed I think.

machi1990 commented 4 years ago

The error message I am seeing is

yarn graphback generate
error Command "graphback" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
craicoverflow commented 4 years ago

Oh. Well then you are right about I think it is because the templates are missing the graphback-cli package. We should add them in.

wtrocki commented 4 years ago

Yep... Amazing catch!