Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit c3af1b8

Browse files
committed
feat(merge): merge with master
2 parents 422d1a7 + 177489c commit c3af1b8

12 files changed

+580
-167
lines changed

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,30 @@
4343
},
4444
"dependencies": {
4545
"immutable": "^3.8.2",
46-
"invariant": "^2.2.2",
47-
"jest-cli": "^23.6.0"
46+
"invariant": "^2.2.2"
4847
},
4948
"peerDependencies": {
5049
"@types/react-relay": ">=1.3.9",
5150
"@types/relay-runtime": ">=1.3.5",
52-
"graphql-compiler": "*",
53-
"relay-compiler": ">=1.7.0",
51+
"relay-compiler": ">=2.0.0",
5452
"relay-runtime": "*",
5553
"typescript": ">=2.9.1"
5654
},
5755
"devDependencies": {
5856
"@types/graphql": "^0.12.1",
59-
"@types/immutable": "3.8.7",
6057
"@types/invariant": "2.2.29",
6158
"@types/jest": "^22.0.1",
6259
"@types/node": "8.5.7",
6360
"@types/relay-runtime": "^1.3.1",
64-
"graphql": "^0.13.2",
61+
"graphql": "^14.1.1",
6562
"husky": "^1.1.0",
6663
"jest": "^23.6.0",
64+
"jest-cli": "^23.6.0",
6765
"lint-staged": "^7.3.0",
6866
"prettier": "^1.10.2",
69-
"relay-compiler": "^2.0.0-rc.1",
70-
"relay-runtime": "^2.0.0-rc.1",
71-
"relay-test-utils": "^2.0.0-rc.1",
67+
"relay-compiler": "^2.0.0",
68+
"relay-runtime": "^2.0.0",
69+
"relay-test-utils": "^2.0.0",
7270
"ts-jest": "^22.0.1",
7371
"tslint": "^5.11.0",
7472
"tslint-config-prettier": "^1.15.0",

src/TypeScriptGenerator.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
import { IRTransforms, TypeGenerator } from "relay-compiler";
1+
import {
2+
IRTransforms,
3+
TypeGenerator,
4+
TypeGeneratorOptions
5+
} from "relay-compiler";
6+
import * as RelayCompilerPublic from "relay-compiler/lib/RelayCompilerPublic";
27

3-
import * as path from "path";
8+
import { GraphQLNonNull } from "graphql";
49
import * as ts from "typescript";
510

611
import {
7-
GraphQLEnumType,
8-
GraphQLNamedType,
9-
GraphQLNonNull,
10-
GraphQLScalarType,
11-
GraphQLType
12-
} from "graphql";
13-
import {
14-
ScalarTypeMapping,
1512
State,
1613
transformInputType,
1714
transformScalarType
1815
} from "./TypeScriptTypeTransformers";
1916

2017
// Get the types
2118
import * as GraphQLCompilerTypes from "graphql-compiler";
22-
// Load the actual code with a fallback to < Relay 1.6 which changed graphql-compiler to an actual package.
23-
let GraphQLCompiler: typeof GraphQLCompilerTypes;
24-
try {
25-
GraphQLCompiler = require("relay-compiler/lib/GraphQLCompilerPublic");
26-
} catch (err) {
27-
GraphQLCompiler = require("graphql-compiler");
28-
}
29-
const { IRVisitor, SchemaUtils } = GraphQLCompiler;
3019

31-
import { TypeGeneratorOptions } from "relay-compiler";
20+
const GraphQLCompiler: typeof GraphQLCompilerTypes = RelayCompilerPublic;
21+
22+
const { IRVisitor, SchemaUtils } = GraphQLCompiler;
3223

3324
const { isAbstractType } = SchemaUtils;
3425

test/TypeScriptGenerator-test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import * as TypeScriptGenerator from '../src/TypeScriptGenerator'
88

99
function generate(text, options) {
1010
const schema = transformASTSchema(RelayTestSchema, [
11-
IRTransforms.schemaExtensions[1], // RelayRelayDirectiveTransform.SCHEMA_EXTENSION,
11+
IRTransforms.schemaExtensions[1], // RelayMatchTransform.SCHEMA_EXTENSION,
12+
IRTransforms.schemaExtensions[2], // RelayRelayDirectiveTransform.SCHEMA_EXTENSION,
1213
]);
1314
const {definitions} = parseGraphQLText(schema, text);
1415
return new GraphQLCompilerContext(RelayTestSchema, schema)
@@ -42,6 +43,7 @@ describe('TypeScriptGenerator without a single artifact directory', () => {
4243
optionalInputFields: [],
4344
relayRuntimeModule: 'relay-runtime',
4445
useHaste: false,
46+
useSingleArtifactDirectory: false,
4547
}),
4648
);
4749
});

0 commit comments

Comments
 (0)