UNPKG

@graphql-inspector/cli

Version:

Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.

59 lines (55 loc) 1.97 kB
#!/usr/bin/env node 'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } const tslib = require('tslib'); const yargs = _interopDefault(require('yargs')); const commands = require('@graphql-inspector/commands'); const loaders = require('@graphql-inspector/loaders'); function main() { return tslib.__awaiter(this, void 0, void 0, function* () { const config = { loaders: ['code', 'git', 'github', 'graphql', 'json', 'url'], commands: ['docs', 'serve', 'diff', 'validate', 'coverage', 'introspect', 'similar', 'audit'], }; const loaders$1 = loaders.useLoaders(config); const commands$1 = commands.useCommands({ config, loaders: loaders$1 }); const root = yargs .scriptName('graphql-inspector') .detectLocale(false) .epilog('Visit https://graphql-inspector.com for more information') .version() .options({ r: { alias: 'require', describe: 'Require modules', type: 'array', }, t: { alias: 'token', describe: 'Access Token', type: 'string', }, h: { alias: 'header', describe: 'Http Header', type: 'array', }, hl: { alias: 'left-header', describe: 'Http Header - Left', type: 'array', }, hr: { alias: 'right-header', describe: 'Http Header - Right', type: 'array', }, }); // eslint-disable-next-line @typescript-eslint/no-unused-expressions commands$1 .reduce((cli, cmd) => cli.command(cmd), root) .help() .showHelpOnFail(false).argv; }); } main();