<commit_before><p align="center">
  <img src="https://github.com/lucasbento/create-graphql/raw/master/content/logo.png">
</p>

<h1 align="center">Create GraphQL</h1>

<p align="center">
  Create production-ready GraphQL servers
</p>
<p align="center">
  <a href="https://travis-ci.org/lucasbento/create-graphql"><img src="https://travis-ci.org/lucasbento/create-graphql.svg?branch=master"></a>
  <a href="https://ci.appveyor.com/project/lucasbento/create-graphql/branch/master"><img src="https://ci.appveyor.com/api/projects/status/cpxul2ofnyf6ypy8/branch/master?svg=true"></a>
  <a href="https://codecov.io/gh/lucasbento/create-graphql"><img src="https://img.shields.io/codecov/c/github/lucasbento/create-graphql.svg"></a>
  <a href="https://github.com/airbnb/javascript"><img src="https://img.shields.io/badge/code%20style-airbnb-blue.svg"></a>
  <a href="https://github.com/lucasbento/create-graphql/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat"></a>
</p>

## About
[Check out the post on Medium!](https://medium.com/entria/announcing-create-graphql-17bdd81b9f96#.idrwtqa9k) 😉

## Install

```sh
npm install --global create-graphql
```

## Update
```sh
npm update --global create-graphql
```

## Usage

It can generate:

- [x] Mutations (create and edit);
- [x] Types;
- [x] Connections;
- [x] Loaders;
- [x] Tests (with [Jest](https://github.com/facebook/jest));
- [x] Generate from a [Mongoose](https://github.com/Automattic/mongoose) schema (with `--schema` option).

### Examples

- Generate a type, the file name will be automatically suffixed with `Type`:
  ```sh
  create-graphql generate --type Awesome # create `AwesomeType`.
  ```

- Generate mutations, the files names will be automatically suffixed with `Mutation`:
  ```sh
  create-graphql generate --mutation Awesome # create `AwesomeAddMutation` & `AwesomeEditMutation`.
  ```

- Generate mutations based on a Mongoose schema:
  ```sh
  create-graphql generate --mutation Awesome --schema Awesome
  ```
  Which will look for `Awesome` Mongoose schema file in `./src/model` and generate the mutations fields based on it.

🔥 **Tip**: You may use aliases commands to create multiple files in one single command:

```sh
create-graphql -tm Awesome --schema Awesome
# Will create a GraphQL type and mutation based on `Awesome` schema.
```

> 😎 Mutations and types will be automatically generated with tests.

### Options

#### `init` - Create a brand-new GraphQL server

```sh
create-graphql init AwesomeProject
```

<p align="center">
  <img src="https://github.com/lucasbento/create-graphql/raw/master/content/create-graphql-init.gif">
</p>

Provides an easy way to create a GraphQL server based on [@entria/graphql-dataloader-boilerplate](https://github.com/entria/graphql-dataloader-boilerplate) which is a production-ready server.<commit_msg>fix README.md<commit_after><p align="center">
  <img src="https://github.com/lucasbento/create-graphql/raw/master/content/logo.png">
</p>

<h1 align="center">Create GraphQL</h1>

<p align="center">
  Create production-ready GraphQL servers
</p>
<p align="center">
  <a href="https://travis-ci.org/lucasbento/create-graphql"><img src="https://travis-ci.org/lucasbento/create-graphql.svg?branch=master"></a>
  <a href="https://ci.appveyor.com/project/lucasbento/create-graphql/branch/master"><img src="https://ci.appveyor.com/api/projects/status/cpxul2ofnyf6ypy8/branch/master?svg=true"></a>
  <a href="https://codecov.io/gh/lucasbento/create-graphql"><img src="https://img.shields.io/codecov/c/github/lucasbento/create-graphql.svg"></a>
  <a href="https://github.com/airbnb/javascript"><img src="https://img.shields.io/badge/code%20style-airbnb-blue.svg"></a>
  <a href="https://github.com/lucasbento/create-graphql/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat"></a>
</p>

## About
[Check out the post on Medium!](https://medium.com/entria/announcing-create-graphql-17bdd81b9f96#.idrwtqa9k) 😉

## Install

```sh
npm install --global create-graphql
```

## Update
```sh
npm update --global create-graphql
```

## Usage

It can generate:

- [x] Mutations (create and edit);
- [x] Types;
- [x] Connections;
- [x] Loaders;
- [x] Tests (with [Jest](https://github.com/facebook/jest));
- [x] Generate from a [Mongoose](https://github.com/Automattic/mongoose) schema (with `--schema` option).

### Examples

- Generate a type, the file name will be automatically suffixed with `Type`:
  ```sh
  create-graphql generate --type Awesome # create `AwesomeType`.
  ```

- Generate mutations, the files names will be automatically suffixed with `Mutation`:
  ```sh
  create-graphql generate --mutation Awesome # create `AwesomeAddMutation` & `AwesomeEditMutation`.
  ```

- Generate mutations based on a Mongoose schema:
  ```sh
  create-graphql generate --mutation Awesome --schema Awesome
  ```
  Which will look for `Awesome` Mongoose schema file in `./src/model` and generate the mutations fields based on it.

🔥 **Tip**: You may use aliases commands to create multiple files in one single command:

```sh
create-graphql generate -tm Awesome --schema Awesome
# Will create a GraphQL type and mutation based on `Awesome` schema.
```

> 😎 Mutations and types will be automatically generated with tests.

### Options

#### `init` - Create a brand-new GraphQL server

```sh
create-graphql init AwesomeProject
```

<p align="center">
  <img src="https://github.com/lucasbento/create-graphql/raw/master/content/create-graphql-init.gif">
</p>

Provides an easy way to create a GraphQL server based on [@entria/graphql-dataloader-boilerplate](https://github.com/entria/graphql-dataloader-boilerplate) which is a production-ready server.
{'fraction_non_alphanumeric': 0.16285564670972247, 'fraction_numerical': 0.005236515971373713, 'mean_word_length': 4.650887573964497, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 59, 'https://': 32, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3643673', 'n_tokens_mistral': 2019, 'n_tokens_neox': 1922, 'n_words': 455}