graphql-cli icon indicating copy to clipboard operation
graphql-cli copied to clipboard

Simplify migration from 3.x to 4.x

Open wtrocki opened this issue 5 years ago • 4 comments

There is 7k public repos using graphql-cli. Most of them use it to getSchema from remote sources. New CLi have this capability but it requires config file that people are not familiar with.

We can address that issue by building compatible command from 3.x (or even bringing the original command with some updates) to let people update it.

wtrocki avatar Sep 30 '20 10:09 wtrocki

Commands of the old cli:

graphql create [directory] Bootstrap a new GraphQL project graphql add-endpoint Add new endpoint to .graphqlconfig graphql add-project Add new project to .graphqlconfig graphql get-schema Download schema from endpoint graphql schema-status Show source & timestamp of local schema graphql ping Ping GraphQL endpoint graphql query Run query/mutation graphql diff Show a diff between two schemas graphql playground Open interactive GraphQL Playground graphql lint Check schema for linting errors graphql prepare Bundle schemas and generate bindings graphql codegen [--target] [--output] Generates apollo-codegen code/annotations from your .graphqlconfig

wtrocki avatar Sep 30 '20 11:09 wtrocki

A quick comparison; create -> init add-endpoint -> not sure if it's needed add-project -> might be tricky get-schema -> codegen with schema-ast can be used under the good schema-status -> we don't have local or remote schemas, we only have one source of schema. So not sure about how this should work because there are different sources of schema other than file system ping -> Maybe introspection query can be called but still there is no standard way to ping the schema(source might not be always URL). query -> There is a tool from Hasura does this job on the command line. We can have a plugin uses that tool under the hood. diff -> I think we have this command already using GraphQL Inspector playground -> I think we have this command as serve with many options lint -> @dotansimha was working on an eslint plugin for that prepare -> This can be done with generic-sdk plugin of codegen. I don't think we need an extra command for this and also prepare sounds too general. codegen -> GraphQL Codegen :)

ardatan avatar Sep 30 '20 12:09 ardatan

yep. Only get schema. I went thru all opensource usages of CLI and in 90% all uses get-schema in their package.json files.

wtrocki avatar Sep 30 '20 13:09 wtrocki

query - yep this one can be extra.

wtrocki avatar Sep 30 '20 13:09 wtrocki