# gb-graphql-cli

> A Command Line interface for GraphQL applications.

Latest version **0.2.1** (published 2019-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install gb-graphql-cli
pnpm add gb-graphql-cli
yarn add gb-graphql-cli
bun add gb-graphql-cli
```

Provides the command `gb-graphql-cli`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2019-02-20 |
| First published | 2018-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 70.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Gabriel Dezan Busarello |
| Maintainers | gabriel200xx |
| Keywords | GraphQL |

## Links

- npm: https://www.npmjs.com/package/gb-graphql-cli
- Repository: https://github.com/gabrielbusarello/gb-graphql-cli
- Issues: https://github.com/gabrielbusarello/gb-graphql-cli/issues
- npm.io page: https://npm.io/package/gb-graphql-cli

## Dependencies (2)

- [colors](https://npm.io/package/colors.md) ^1.3.2
- [commander](https://npm.io/package/commander.md) ^2.18.0

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2019-02-20
- 0.2.0 — 2019-02-20
- 0.1.5 — 2018-12-05
- 0.1.2 — 2018-12-01
- 0.1.1 — 2018-11-28
- 0.1.0 — 2018-11-27
- 0.0.5 — 2018-11-25
- 0.0.4 — 2018-11-25
- 0.0.3 — 2018-11-19
- 0.0.2 — 2018-11-19
- 0.0.1 — 2018-11-19

## README

# GraphQL CLI
A Command Line interface for GraphQL applications.

[![GitHub forks](https://img.shields.io/github/forks/gabrielbusarello/gb-graphql-cli.svg?style=social)](https://github.com/gabrielbusarello/gb-graphql-cli/fork) [![GitHub stars](https://img.shields.io/github/stars/gabrielbusarello/gb-graphql-cli.svg?style=social)](https://github.com/gabrielbusarello/gb-graphql-cli/stargazers)

[![GitHub license](https://img.shields.io/github/license/gabrielbusarello/gb-graphql-cli.svg)](https://github.com/gabrielbusarello/gb-graphql-cli/blob/master/LICENSE)

# Usage

## Installation
```sh
npm install -g gb-graphql-cli
```

### Running `gb-graphql-cli --help`
```sh
Usage: gb-graphql-cli [options] [command]

Options:

  -v, --version              output the version number
  -h, --help                 output usage information

Commands:

  init [options] <projname>  Init the GraphQL project
  run                        Start the development server
  create <schema> <name>     Create files based on a schematic. Possible schemas: (model, resource)

Examples:
   gb-graphql-cli init helloWorld
   gb-graphql-cli init helloWorld -d mssql
   gb-graphql-cli init helloWorld -a
   gb-graphql-cli run
   gb-graphql-cli create model example

```

## How to Use - Initializing a new GraphQL project
Assuming that you have installed the cli, follow the steps below for run your first application.
1. The first step, is initialize the project:
```sh
gb-graphql-cli init helloWorld
# If you are using another DBMS, you can set like that:
# Possible values: (mysql, mssql, sqlite, postgres)
gb-graphql-cli init helloWorld --dialect mssql
```
2. Don't forget that you have to change the JWT_SECRET in package.json.
3. After the initialization finishes, you have to start your database service and create a database named "helloWorld".
4. With database service started, go to config.json file, located in "helloWorld/src/config/config.json".
5. Change the "database" key, of key "development" to the name "helloWorld".
```json
{
    "development": {
        "username": "root",
        "password": null,
        "database": "helloWorld",
        "host": "127.0.0.1",
        "dialect": "mysql"
    },
    "test": {
        "username": "root",
        "password": null,
        "database": "database_test",
        "host": "127.0.0.1",
        "dialect": "mysql"
    },
    "production": {
        "username": "root",
        "password": null,
        "database": "database_production",
        "host": "127.0.0.1",
        "dialect": "mysql"
    }
}
```
6. Now it's time to run the application. Go to main of your project and type `gb-graphql-cli run`.
7. Wait for the build and the nodemon server being ready.
8. Access `localhost:3000/graphql`. As this application is from GraphQL, just have one end-point. In development environment, accessing this end-point in browser you will see the Graph*i*QL interface.
9. Now you can create mutations and queries for the ExampleModel.
10. Enjoy!

---
_Source: https://npm.io/package/gb-graphql-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
