# gql-schema-cli

> You can easily generate graphql schema.

Latest version **1.0.1** (published 2021-12-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install gql-schema-cli
pnpm add gql-schema-cli
yarn add gql-schema-cli
bun add gql-schema-cli
```

Provides the command `gsc`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-12-07 |
| First published | 2021-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | deerpark |
| Maintainers | deerpark |

## Links

- npm: https://www.npmjs.com/package/gql-schema-cli
- Repository: https://github.com/deerpark/gql-schema-cli
- Homepage: https://github.com/deerpark/gql-schema-cli#readme
- Issues: https://github.com/deerpark/gql-schema-cli/issues
- npm.io page: https://npm.io/package/gql-schema-cli

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^5.0.0
- [inquirer](https://npm.io/package/inquirer.md) ^8.2.0
- [commander](https://npm.io/package/commander.md) ^8.3.0

## Recent versions

- 1.0.1 (latest) — 2021-12-07
- 1.0.0 — 2021-12-04

## README

# gql-schema-cli
You can easily generate graphql schema.

## Installation
```bash
npm install gql-schema-cli
```

## Useage
```bash
gsc tpl createAccount
---
users/createAccount/createAccount.resolvers.js creation complete
users/createAccount/createAccount.typeDefs.js creation complete
```

## Options

### root
root folder name
- default: users

### type
scheme type: Query | Mutation
- default: Query

## Template

### {{root}}/{{schema}}/{{schema}}.resolvers.js
```js
import client from '../../client'
  import { protectedResolver } from '../users.utility'
  
  const {{schema}}ResolverFn = async (
    _,
    {  },
    { loggedInUser }
  ) => {
    if () {
      return {
        ok: true,
      }
    } else {
      return {
        ok: false,
        error: '.',
      }
    }
  }
  
  export default {
    Mutation: {
      editProfile: protectedResolver({{schema}}ResolverFn),
    },
  }
  
```

### {{root}}/{{schema}}/{{schema}}.typeDefs.js
```js
import { gql } from 'apollo-server'
  
  export default gql`
    type {{schema}}Result {
      ok: Boolean!
      error: String
    }
    type {{type}} {
      editProfile(
        firstName: String
        lastName: String
        username: String
        email: String
        password: String
        bio: String
        avatar: Upload
      ): {{schema}}Result!
    }
  `
  
```

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