List of available commands
Provides an easy way to create a GraphQL server based on @entria/graphql-dataloader-boilerplate which is a production-ready server
We are currently using the same boilerplate on three applications running on production at @entria
create-graphql init GraphQLProjectCreates a new GraphQL project. The project contains the following structure:
├── /data/ # GraphQL generated schema
├── /repl/ # Read-Eval-Print-Loop (REPL) configuration
├── /scripts/ # Generate GraphQL schema script
├── /src/ # Source code of GraphQL Server
│ ├── /connection/ # Connections types (Relay)
│ ├── /interface/ # NodeInterface (Relay)
│ ├── /loader/ # Loaders of the models using DataLoader
│ ├── /model/ # Models definition (Mongoose, SQL, Google DataStore)
│ ├── /mutation/ # Mutations definition
├── /test/ # Test helpers
Generates the files by passing these options:
Creates a type file and it's name will be automatically suffixed with Type
create-graphql generate --type StoryGenerates StoryType file under the path ./src/type
Creates mutations, the files names will be automatically suffixed with Mutation
create-graphql generate --mutation StoryGenerates StoryAddMutation and StoryEditMutation under the path ./src/mutation
Hint: To generates mutations based on a Mongoose schema, use --schema option
create-graphql generate --mutation Story --schema StoryWhich will look for Story Mongoose schema file in ./src/model and generate the mutations fields based on it
Hint: you may use aliases commands to create multiple files in one single command:
create-graphql generate -tm Story --schema StoryWill create a GraphQL type and mutation based on Story schema and automatically generated tests using Jest
Creates a GraphQL loader, the files names will be automatically suffixed with Loader
create-graphql generate --loader StoryGenerates a StoryLoader file importing StoryConnection under the path ./src/loader
Creates a Relay connection, the files names will be automatically suffixed with Connection
create-graphql generate --connection StoryGenerates a StoryConnection importing StoryType under the path ./src/connection
Output usage information with all available commands
Output the current version
If yout need, you can update Create-GraphQL with:
yarn global upgrade create-graphql # Also works with NPM as `npm update --global create-graphql`