How to use the graphql-config.getSchemaExtensions function in graphql-config

To help you get started, we’ve selected a few graphql-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Urigo / graphql-cli / src / cmds / schema-status.ts View on Github external
throw new Error('No `schemaPath` found in GraphQL config file.')
  }

  const relativeSchemaPath = relative(process.cwd(), schemaPath)

  if (!existsSync(schemaPath)) {
    console.log(
      chalk.yellow("Schema file doesn't exist at ") +
        chalk.blue(relativeSchemaPath),
    )
    return
  }

  const extensions = {
    schemaPath: relativeSchemaPath,
    ...getSchemaExtensions(schemaPath),
  }
  const maxLength = _(extensions)
    .keys()
    .map('length')
    .max()

  for (let name in extensions) {
    const padName = _.padStart(name, maxLength)
    console.log(`${padName}\t${chalk.blue(extensions[name])}`)
  }

  if (Object.keys(extensions).length === 0) {
    return
  }
}