Skip to content

Commit

Permalink
feat(graphql): Upgrade GraphQL to v14
Browse files Browse the repository at this point in the history
  • Loading branch information
maticzav committed Nov 16, 2018
1 parent e2c01be commit cd8ac54
Show file tree
Hide file tree
Showing 4 changed files with 788 additions and 18 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
"test": "npm-run-all lint test-only"
},
"devDependencies": {
"@types/graphql": "0.13.0",
"@types/graphql": "14.0.3",
"@types/node": "10.0.2",
"apollo-link": "1.2.2",
"ava": "^0.25.0",
"graphql": "0.13.2",
"graphql": "^14.0.2",
"graphql-tag": "^2.9.2",
"npm-run-all": "^4.1.3",
"rimraf": "^2.6.2",
Expand All @@ -51,6 +51,6 @@
"yargs": "^11.0.0"
},
"peerDependencies": {
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0"
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0"
}
}
9 changes: 5 additions & 4 deletions src/codegen/FlowGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
GraphQLFieldMap,
GraphQLObjectType as GraphQLObjectTypeRef,
} from 'graphql'
import Maybe from 'graphql/tsutils/Maybe'

export class FlowGenerator extends Generator {
scalarMapping = {
Expand Down Expand Up @@ -338,7 +339,7 @@ ${this.renderTypes()}`

renderTypeWrapper(
typeName: string,
typeDescription: string | void,
typeDescription: Maybe<string>,
fieldDefinition: string,
): string {
return `${this.renderDescription(
Expand All @@ -348,7 +349,7 @@ ${this.renderTypes()}`

renderObjectWrapper(
typeName: string,
typeDescription: string | void,
typeDescription: Maybe<string>,
objects: GraphQLObjectTypeRef[],
fieldDefinition: string,
): string {
Expand All @@ -360,7 +361,7 @@ ${this.renderTypes()}`

renderInterfaceWrapper(
typeName: string,
typeDescription: string | void,
typeDescription: Maybe<string>,
interfaces: GraphQLInterfaceType[],
fieldDefinition: string,
): string {
Expand All @@ -375,7 +376,7 @@ ${fieldDefinition}
|}`
}

renderDescription(description?: string | void): string {
renderDescription(description: Maybe<string>): string {
return `${
description
? `/*
Expand Down
7 changes: 4 additions & 3 deletions src/codegen/TypescriptGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
GraphQLFieldMap,
GraphQLObjectType as GraphQLObjectTypeRef,
} from 'graphql'
import Maybe from 'graphql/tsutils/Maybe'

import { Generator } from './Generator'

Expand Down Expand Up @@ -333,7 +334,7 @@ ${this.renderTypes()}`

renderTypeWrapper(
typeName: string,
typeDescription: string | void,
typeDescription: Maybe<string>,
fieldDefinition: string,
): string {
return `${this.renderDescription(
Expand All @@ -345,7 +346,7 @@ ${fieldDefinition}

renderInterfaceWrapper(
typeName: string,
typeDescription: string | void,
typeDescription: Maybe<string>,
interfaces: GraphQLInterfaceType[],
fieldDefinition: string,
): string {
Expand All @@ -360,7 +361,7 @@ ${fieldDefinition}
}`
}

renderDescription(description?: string | void) {
renderDescription(description: Maybe<string>) {
return `${
description
? `/*
Expand Down
Loading

0 comments on commit cd8ac54

Please sign in to comment.