# gql-folder-cli

> Create a clean resolver folder structure based on a GraphQL schema

Latest version **1.0.7** (published 2022-05-29) · MIT license · 0 weekly downloads

## Install

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

Provides the command `init-gql-resolvers`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2022-05-29 |
| First published | 2022-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Maxim Buz |
| Maintainers | maximbuz |
| Keywords | cli, graphql, resolvers, generator, clean folder structure |

## Links

- npm: https://www.npmjs.com/package/gql-folder-cli
- Repository: https://github.com/MaximBuz/custom-cli-tools.git#main
- Homepage: https://github.com/MaximBuz/custom-cli-tools/tree/main/gql-folders#readme
- Issues: https://github.com/MaximBuz/custom-cli-tools/issues
- npm.io page: https://npm.io/package/gql-folder-cli

## Recent versions

- 1.0.7 (latest) — 2022-05-29
- 1.0.6 — 2022-05-29
- 1.0.5 — 2022-05-29
- 1.0.4 — 2022-05-25
- 1.0.3 — 2022-05-25
- 1.0.2 — 2022-05-25
- 1.0.1 — 2022-05-25
- 1.0.0 — 2022-05-25

## README

# Generate GraphQL Resolver Templates
### Easily create a clean folder structure based on a GraphQL schema string

Just go into the folder that contains a file containing your GraphQL schema and run <code>npx gql-folder-cli [filename.js] [variableName]</code>.
By default, filename.js will be <code>schema.js</code> and variableName will be <code>typeDefs</code>.

The file containing your GraphQL schema should look as follows:

     export const typeDefs = `
      type User {
        id: Int!
        username: String!
      }

      type Something {
        id: Int!
        user: User
        userId: Int!
      }

      type Mutation {
        createNewUser(email: String!): User
        createSomething: Something
      }
    `;


The generated folder structure will rougly look as follows:
    
     resolvers/
      ├─ mutations/
      │  ├─ createSomething.js
      │  ├─ index.js
      ├─ something/
      │  ├─ index.js
      │  ├─ user.js
      ├─ user/
      │  ├─ index.js
      ├─ index.js


Every file initializes the resolver functions and exports them in the index.js.
The main index.js will look as follows:

      import { User } from "./user";
      import { Something } from "./something";
      import { Mutation } from "./mutations";

      export const resolvers = {
        User,
        Something,
        Mutation,
      };

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