0.3.0 • Published 2 years ago

update-graphql-schema v0.3.0

Weekly downloads
901
License
MIT
Repository
github
Last release
2 years ago

update-graphql-schema

A module and cli tool for updating graphql schema from Graphql server

CircleCI branch Codecov Dependencies DevDependencies

npm package npm downloads

Usage

Install

Use npm:

npm i update-graphql-schema
npm i update-graphql-schema -g

Or use yarn:

yarn add update-graphql-schema
yarn global add update-graphql-schema

Cli

Usage: updateSchema [options] <file ...>

Options:
  -v, --version            output the version number
  -c, --config <file ...>  Config files path
  -h, --headers <items>    Request Headers
  -o, --output <file ...>  Output Path, Default: `${process.cwd()}/schema.json`
  -p, --point [value]      Endpoint url
  -t, --type [value]       Schema type `json` or `graphql`. Note: It will always be `json` if output file extension is `json`.
  -h, --help               output usage information

With Config File

Config file ./updateSchemaConf.js

module.exports = {
  point: 'https://your.graphql.server/graphq',
  output: './schema.json',
  type: 'json', // or graphq
  headers: {
    authorization: 'bear XXXXXXXXXXXXXXXXXX',
  },
};

Or use json conf ./updateSchemaConf.json

{
  "point": "https://your.graphql.server/graphq",
  "output": "./schema.graphql",
  "type": "graphql",
  "headers": {
    "authorization": "bear XXXXXXXXXXXXXXXXXX"
  }
}

Then, run this command

updateSchema -c ./updateSchemaConf.js
// or
// updateSchema -c ./updateSchemaConf.json

Node modules

const updateGraphqlSchema = require('update-graphql-schema');
const path = require('path');

updateGraphqlSchema({
  endPoint: 'https://api.github.com/graphql',
  output: path.resolve(__dirname, 'schema.graphql'),
  schemaType: 'graphql',
  headers: {
    Authorization: 'bearer 4ad4XXXXXXXXXXXXXXXXX85bf7',
  },
});

Contributing

DefinitelyTyped only works because of contributions by users like you!

Git Message

Follow the Angular git commit message specification

But, you can ignore the scope

0.3.0

2 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

5 years ago