# @github-graph/cli

> Generate a strongly typed API for GitHub from a set of GraphQL Queries.

Latest version **1.1.0** (published 2020-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @github-graph/cli
pnpm add @github-graph/cli
yarn add @github-graph/cli
bun add @github-graph/cli
```

Provides the command `github-graph`.

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-03-20 |
| First published | 2020-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 282.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Forbes Lindesay |
| Maintainers | forbeslindesay |

## Links

- npm: https://www.npmjs.com/package/@github-graph/cli
- Repository: https://github.com/ForbesLindesay/github-graph
- Homepage: https://github.com/ForbesLindesay/github-graph#readme
- Issues: https://github.com/ForbesLindesay/github-graph/issues
- npm.io page: https://npm.io/package/@github-graph/cli

## Dependencies (6)

- [graphql](https://npm.io/package/graphql.md) ^14.6.0
- [camel-case](https://npm.io/package/camel-case.md) ^4.1.1
- [@babel/code-frame](https://npm.io/package/@babel/code-frame.md) ^7.8.3
- [apollo-codegen-core](https://npm.io/package/apollo-codegen-core.md) ^0.36.4
- [@octokit/graphql-schema](https://npm.io/package/@octokit/graphql-schema.md) ^6.70.0
- [apollo-codegen-typescript](https://npm.io/package/apollo-codegen-typescript.md) ^0.36.4

## Recent versions

- 1.1.0 (latest) — 2020-03-20
- 1.0.1 — 2020-03-15
- 1.0.0 — 2020-03-15

## README

# @github-graph/cli

Generate a strongly typed API for GitHub from a set of GraphQL Queries.

## Installation

```
yarn add @github-graph/cli
```

## Usage

api.graphql

```graphql
query GetLogin {
  viewer {
    login
  }
}

query GetStargazers($owner: String!, $name: String!) {
  repository(owner: $owner, name: $name) {
    nameWithOwner
    stargazers {
      totalCount
    }
  }
}

query GetWatchers($owner: String!, $name: String!) {
  repository(owner: $owner, name: $name) {
    nameWithOwner
    watchers {
      totalCount
    }
  }
}
```

Then build it with:

```
npx @github-graph/cli api.graphql
```

Then import:

```ts
import Client, {auth} from '@github-graph/api';
import {getStargazers, getWatchers} from './api';

const client = new Client({
  auth: auth.createTokenAuth(GITHUB_TOKEN),
});

await Promise.all([
  getStargazers(client, {owner: 'pugjs', name: 'pug'}),
  getWatchers(client, {owner: 'pugjs', name: 'pug'})),
  getStargazers(client, {owner: 'ForbesLindesay', name: 'atdatabases'}),
  getWatchers(client, {owner: 'ForbesLindesay', name: 'atdatabases'}),
]);
```

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