update-graphql-schema
v0.3.0
Published
A module and cli tool for updating graphql schema
Downloads
249
Readme
update-graphql-schema
A module and cli tool for updating graphql schema from Graphql server
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