graphql-typed-client
Version:
A tool that generates a strongly typed client library for any GraphQL endpoint. The client allows writing GraphQL queries as plain JS objects (with type safety, awesome code completion experience, custom scalar type mapping, type guards and more)
17 lines (13 loc) • 491 B
text/typescript
import Listr from 'listr'
import { ListrTask } from 'listr'
import { Config } from '../config'
import { clientTasks } from './clientTasks'
import { schemaTask } from './schemaTask'
export const task = (config: Config): ListrTask => {
if (!config.output) throw new Error('`output` must be defined in the config')
const output = config.output
return {
title: `generating the client in \`${output}\``,
task: () => new Listr([schemaTask(config), ...clientTasks(config)]),
}
}